Repository navigation
[inductor] Fix CPP wrapper lazy compile for scalar tensor args - #178478
desertfire wants to merge 1 commit into
Conversation
In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/178478
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit ce68b3d with merge base a1915b6 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. ghstack-source-id: 92d087b Pull Request resolved: #178478
|
@pytorchbot merge -f "cpp wrapper fix only and the CI has passed. force merge to make CI green" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
Thank you @desertfire for fixing #178509 and #178413 - once fix is confirmed will close these issues |
In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: #178478 Approved by: https://github.com/PaulZhang12 Co-authored-by: Xia-Weiwen <[email protected]>
…ch#178478) In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: pytorch#178478 Approved by: https://github.com/PaulZhang12
In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: #178478 Approved by: https://github.com/PaulZhang12
…ch#178478) In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: pytorch#178478 Approved by: https://github.com/PaulZhang12
…ch#178478) In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: pytorch#178478 Approved by: https://github.com/PaulZhang12
…ch#178478) In the lazy compile path, `runTritonKernelWithAutotune` passes all args to the Python `run_triton_kernel_with_autotune` which calls `kernel_fn.run()`. The C++ `convertArgToPython` converts `AtenTensorHandle` to Python tensors, but for UnwrapUnspecArg (0-dim scalar tensors like uint8/bfloat16), Triton's launcher now expects Python scalars, not tensors. Extract the scalar value via `codegen_tensor_item` before the autotune call, matching the direct kernel launch path which already does this. Authored with Claude. Pull Request resolved: pytorch#178478 Approved by: https://github.com/PaulZhang12
Stack from ghstack (oldest at bottom):
In the lazy compile path,
runTritonKernelWithAutotunepasses allargs to the Python
run_triton_kernel_with_autotunewhich callskernel_fn.run(). The C++convertArgToPythonconvertsAtenTensorHandleto Python tensors, but for UnwrapUnspecArg (0-dimscalar tensors like uint8/bfloat16), Triton's launcher now expects
Python scalars, not tensors.
Extract the scalar value via
codegen_tensor_itembefore theautotune call, matching the direct kernel launch path which already
does this.
Authored with Claude.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo