Update 02-fused-softmax.md#24
Open
GlowLED wants to merge 1 commit intohyperai:masterfrom
Open
Conversation
compiled kernel启动时,现在的官方文档已经是需要传入BLOCK SIZE和num stages的写法了。现在compiled kernel启动时需要传入constexpr参数。
按照原写法,启动kernel时会报错:Traceback (most recent call last):
File "/root/triton-learn/src/fused_softmax.py", line 92, in <module>
y_triton = fused_softmax(x)
File "/root/triton-learn/src/fused_softmax.py", line 78, in fused_softmax
kernel[(num_programs, 1, 1)](
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
x,
^^
...<4 lines>...
n_cols,
^^^^^^^
)
^
File "/root/triton-learn/.venv/lib/python3.13/site-packages/triton/compiler/compiler.py", line 498, in runner
self.run(grid[0], grid[1], grid[2], stream, self.function, self.packed_metadata, launch_metadata,
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
knobs.runtime.launch_enter_hook, knobs.runtime.launch_exit_hook, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/triton-learn/.venv/lib/python3.13/site-packages/triton/backends/nvidia/driver.py", line 713, in __call__
self.launch(gridX, gridY, gridZ, stream, function, self.launch_cooperative_grid, self.launch_pdl,
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
global_scratch, profile_scratch, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: function takes exactly 21 arguments (19 given)
少了两个参数,正好是那两个constexpr。
详情见英文官方文档:https://triton-lang.org/main/getting-started/tutorials/02-fused-softmax.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compiled kernel启动时,现在的官方文档已经是需要传入BLOCK SIZE和num stages的写法了。现在compiled kernel启动时需要传入constexpr参数。 按照原写法,启动kernel时会报错:Traceback (most recent call last):
File "/root/triton-learn/src/fused_softmax.py", line 92, in
y_triton = fused_softmax(x)
File "/root/triton-learn/src/fused_softmax.py", line 78, in fused_softmax
kernel[(num_programs, 1, 1)](
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
x,
^^
...<4 lines>...
n_cols,
^^^^^^^
)
^
File "/root/triton-learn/.venv/lib/python3.13/site-packages/triton/compiler/compiler.py", line 498, in runner
self.run(grid[0], grid[1], grid[2], stream, self.function, self.packed_metadata, launch_metadata,
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
knobs.runtime.launch_enter_hook, knobs.runtime.launch_exit_hook, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/triton-learn/.venv/lib/python3.13/site-packages/triton/backends/nvidia/driver.py", line 713, in call
self.launch(gridX, gridY, gridZ, stream, function, self.launch_cooperative_grid, self.launch_pdl,
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
global_scratch, profile_scratch, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: function takes exactly 21 arguments (19 given)
少了两个参数,正好是那两个constexpr。
详情见英文官方文档:https://triton-lang.org/main/getting-started/tutorials/02-fused-softmax.html