Merged
Conversation
Signed-off-by: Gavin Zhao <git@gzgz.dev>
Signed-off-by: Gavin Zhao <git@gzgz.dev>
Signed-off-by: Gavin Zhao <git@gzgz.dev>
Contributor
Author
|
Oh this issue is a compiler optimization bug that seems to only happen with FP64: diff --git a/include/ck/tensor_operation/gpu/grid/gridwise_elementwise_2d.hpp b/include/ck/tensor_operation/gpu/grid/gridwise_elementwise_2d.hpp
index 839a68a978..142f084a67 100644
--- a/include/ck/tensor_operation/gpu/grid/gridwise_elementwise_2d.hpp
+++ b/include/ck/tensor_operation/gpu/grid/gridwise_elementwise_2d.hpp
@@ -33,6 +33,16 @@
const Block2TileMap block_2_tile_map,
const ElementwiseOperation elementwise_op)
{
+#if defined(__gfx101__)
+ // Workaround for gfx101x FP64 compiler bug: prevent incorrect optimization
+ // The compiler appears to misoptimize FP64 elementwise kernels without this barrier
+ if(threadIdx.x == 0 && blockIdx.x == 0)
+ {
+ // Use volatile pointer dereference to force memory dependency
+ auto ptr = p_in_global_tuple[Number<0>{}];
+ asm volatile("" : "+v"(ptr) :: "memory");
+ }
+#endif
GridwiseElementwiseFunctor::Run(in_grid_desc_tuple,
out_grid_desc_tuple,
p_in_global_tuple,This fixes the test. Unfortunately I'm unable to create a minimum working example. |
Collaborator
|
Thanks, I appreciate the effort to add support on gfx101x. Our main issue with gfx101x is that we don't have the hardware to keep running and testing on a regular basis. Hence no official support. But I would be open to merging this. |
Contributor
Author
|
Thank you! I completely understand that gfx101x has no official support, so this patch was written in a way such that it shouldn't affect other architectures. |
Collaborator
|
OK, I've made sure this passes through the CI and made inquiries about the hardware. Sounds like we may have something we could use. So I think we can merge this. |
illsilin
approved these changes
Nov 20, 2025
Contributor
Author
|
Thank you! |
AviralGoelAMD
pushed a commit
that referenced
this pull request
Nov 28, 2025
* Allow compilation for RDNA1 (__gfx101__) Signed-off-by: Gavin Zhao <git@gzgz.dev> * More RDNA1 changes Signed-off-by: Gavin Zhao <git@gzgz.dev> * Even more RDNA1 changes Signed-off-by: Gavin Zhao <git@gzgz.dev> * cmake: skip build quantization for unsupported arches * add gfx10-1-generic support as well * add gfx1013 and complete gfx10-1-generic * fix clang format * enable DL kernels on gfx101x --------- Signed-off-by: Gavin Zhao <git@gzgz.dev> Co-authored-by: illsilin_amdeng <Illia.Silin@amd.com> Co-authored-by: Illia Silin <98187287+illsilin@users.noreply.github.com>
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.
Proposed changes
Support compiling and running CK on RDNA1 GPUs (including the new
gfx10-1-generictarget). This just involves#if defined(__gfx10x__)guards to includedefined(__gfx101__)ckProfiler"unable to find-ldevice_quantization", since device quantization instances seem to be incompatible/unavailable for RDNA1 GPUs.Fixes #2411.
Fixes #3185.
Test plan
Built CK on an AWS
g4ad.xlargeinstance (gfx1011) and ran tests as follows:109/110 tests reliably pass.
test_batchnorm_infer_rank_4fails (<1% has wrong values) due to a compiler bug documented at the end..Checklist
Please put an
xinto the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.clang-formaton all changed filesDiscussion
I don't understand the hardware capabilities of RDNA1 and what capabilities are required by CK, so I'd hope if some maintainers of CK can check if RDNA1 GPUs are indeed incompatible with device quantization and if they have a more robust solution to the linker error.
Running unmodified, test
test_batchnorm_infer_rank_4fails with the below output:Test output
HOWEVER upon applying this patch that adds only debug output, the test succeeds no matter how many times I run it:
Logging patch
UPDATE: this is a compiler bug, see comment