-
Notifications
You must be signed in to change notification settings - Fork 24.7k
[ROCm] fix torch.layer_norm invalid configuration problem when input is large tensor #144007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ROCm] fix torch.layer_norm invalid configuration problem when input is large tensor #144007
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/144007
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b67eb8b with merge base 2966fb3 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test for this case
will do. |
…r its output value too
@pytorchmergebot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Fixes #136291
This PR is to fix the
invalid configuration argument
problem happened on ROCm when input is a large tensor when callingtorch.layer_norm
.After investigation, I found that the reason why this error happened is: The amd compute language runtime checks whether
gridDim.x * blockDim.x
is greater thanstd::numeric_limits<uint32_t>::max()
or not. If yes, it will error out with the "invalid configuration argument" message.The fix is to split the whole task to several chunks so that each chunk will not trigger the failure condition. This will ensure the correctness and completeness given the current kernel implementation logic of
vectorized_layer_norm_kernel
.Also added a largeTensor layer_norm unit test
test_layer_norm_large_tensor
with the same shape[16, 3000, 3000, 16]
as the one used by the pytorch issue #136291 so that the unit test can check the expected output value to ensure correctness.The future work may include performance optimization of layer_norm and CK layer_norm integration.
cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @naromero77amd