pytorch/docs/source
Sherlockk Huang 8b6a78f39f Python Interface for Jiterator
This PR allows user to author a CUDA kernel in python.

```
from torch.cuda.jiterator import create_jit_fn

code_string = "template <typename T> T my_kernel(T x, T y, T alpha) { return  -x * y + x - y + alpha; }"
jitted_fn = create_jit_fn(code_string, alpha=0)

a = torch.rand(3, device='cuda')
b = torch.rand(3, device='cuda')
result = jitted_fn(a, b, alpha=1.0)
```

Limitations:
- Only supports elementwise kernel
- 1~8 tensor inputs (empty input, e.g. factory methods, is not supported)
- inputs tensors must live in cuda device
- cpu Scalar is not supported
- kwargs must be pre-declared when calling create_jit_fn
- kwargs must be convertible to at::Scalar, one of float64, int64_t, bool. (complex not support for now)

TODOs:
- [x] consolidate union and c10::variant implementation
- [x] plug into existing op testing framework
- [ ] rename files, place files in the right folder
- [ ] place util functions in the right file
- [x] enforce assumptions in python interface e.g <8 inputs, kwargs types
- [x] Add user-facing documentation
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76394
Approved by: https://github.com/mruberry
2022-05-06 18:44:28 +00:00
..
_static
_templates
community Update persons of interest for ONNX (#72072) 2022-02-16 23:01:13 +00:00
elastic
notes fix docs error in Autograd Mechanics 2022-03-29 18:32:16 +00:00
rpc
scripts [quant][fx] Move backend_config folder to torch.ao.quantization 2022-04-19 15:38:57 +00:00
amp.rst add autocast cpu doc 2022-03-22 02:02:43 +00:00
autograd.rst Targeted documentation updates in autograd.functional (#72111) 2022-02-02 03:19:31 +00:00
backends.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
benchmark_utils.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
bottleneck.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
checkpoint.rst
complex_numbers.rst
conf.py [quant][fx] Move backend_config folder to torch.ao.quantization 2022-04-19 15:38:57 +00:00
config_mod.rst rename config module file to work with gh pages better 2022-03-10 20:41:44 +00:00
cpp_extension.rst Check clang++/g++ version when compiling CUDA extensions (#63230) 2022-02-24 08:32:32 +00:00
cpp_index.rst
cuda.rst Python Interface for Jiterator 2022-05-06 18:44:28 +00:00
cudnn_persistent_rnn.rst
cudnn_rnn_determinism.rst
data.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
ddp_comm_hooks.rst
deploy.rst Back out "Back out "[torch deploy] Update deploy.rst with working simple example"" (#76713) 2022-05-03 14:12:18 +00:00
distributed.algorithms.join.rst
distributed.elastic.rst
distributed.optim.rst
distributed.rst Add TORCH_CPP_LOG_LEVEL to the docs 2022-05-03 17:01:11 +00:00
distributions.rst
dlpack.rst
docutils.conf
fft.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
fsdp.rst make fsdp folder to be public (#72084) 2022-02-02 15:50:14 +00:00
futures.rst
fx.rst Fix doc build 2022-04-19 04:07:47 +00:00
hub.rst
index.rst Revert "Contribution- Grammatical Corrections in the documentation" 2022-05-05 23:13:10 +00:00
jit_builtin_functions.rst
jit_language_reference_v2.rst
jit_language_reference.rst
jit_python_reference.rst
jit_unsupported.rst
jit.rst [Reland take-2] Add JIT graph fuser for oneDNN Graph API (v0.5) 2022-05-05 16:57:03 +00:00
linalg.rst Add linalg.vander 2022-05-06 08:44:14 +00:00
math-quantizer-equation.png
mobile_optimizer.rst
model_zoo.rst
monitor.rst torch/monitor: merge Interval and FixedCount stats (#72009) 2022-01-30 23:21:59 +00:00
multiprocessing.rst
name_inference.rst
named_tensor.rst
nested.rst Minimal NestedTensor (#72881) 2022-03-02 16:31:51 +00:00
nn.functional.rst Revert D34154832: [pytorch][PR] Add multi_head_attention_forward to functional rst docs 2022-02-11 05:08:46 +00:00
nn.init.rst add trunc_normal_ function to doc of torch.nn.init 2022-05-06 14:33:08 +00:00
nn.rst move the stateless util to public API! 2022-04-21 13:42:24 +00:00
onnx_supported_aten_ops.rst Add list of supported ATen ops by ONNX converter into torch.onnx page 2022-04-07 00:05:44 +00:00
onnx.rst Update onnx.rst 2022-04-08 20:07:01 +00:00
optim.rst
package.rst Fix some typos. 2022-04-11 21:55:59 +00:00
pipeline.rst
profiler.rst
quantization-backend-configuration.rst quantization: autogenerate quantization backend configs for documentation (#75126) 2022-04-04 22:22:30 +00:00
quantization-support.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
quantization.rst [quant][docs] Fix formatting for quantization.rst (#76223) 2022-04-26 03:16:39 +00:00
random.rst
rpc.rst Add note in RPC docs about retries. (#73601) 2022-03-03 00:29:31 +00:00
sparse.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
special.rst Implement torch.special.log_ndtr 2022-03-29 23:13:37 +00:00
storage.rst Virtualize <type>Storage classes (#66970) 2022-03-22 23:44:48 +00:00
tensor_attributes.rst fix wrong indexing of class names in docs 2022-03-02 22:21:21 +00:00
tensor_view.rst Correcting a minor typo: "Users should pay" instead of "Users should be pay" (#72500) 2022-02-08 23:08:25 +00:00
tensorboard.rst Cleanup all module references in doc (#73983) 2022-03-10 22:26:29 +00:00
tensors.rst [complex32] add chalf alias for complex32 and chalf method 2022-04-20 23:44:47 +00:00
testing.rst promote torch.testing to stable (#73348) 2022-02-25 06:30:31 +00:00
torch.ao.ns._numeric_suite_fx.rst
torch.ao.ns._numeric_suite.rst
torch.overrides.rst
torch.rst Add high level control of fp32 matmul precision; disable TF32 for matmuls by default 2022-05-04 20:40:13 +00:00
type_info.rst