[TT-Train] Fix GCC build: qualify self-referential using declarations (#37922)#37924
Open
epam-iaroslav-voitovych wants to merge 1 commit intomainfrom
Open
[TT-Train] Fix GCC build: qualify self-referential using declarations (#37922)#37924epam-iaroslav-voitovych wants to merge 1 commit intomainfrom
epam-iaroslav-voitovych wants to merge 1 commit intomainfrom
Conversation
…larations 5 device operation headers use `using operation_attributes_t = operation_attributes_t;` which GCC rejects as self-referential per C++ [basic.scope.class]/2 (Clang is lenient and accepts it). Fix: use fully-qualified namespace paths, matching the pattern already used by 8 other device operations in the same codebase (rmsnorm_fw, rmsnorm_bw, softmax, silu_bw, cross_entropy_fw, etc.). Fixes #37922
Contributor
Author
Container verificationVerified in Docker container builds using parameterized build scripts that merge branches on top of main and optionally override the tt-train compiler:
Build 1 confirms GCC 12 now compiles tt-train successfully with the qualified Build commands used: # Build 1: gcc-12 override
./build_tt_docker.sh --branch main \
--merge-branch ivoitovych/issue-36993-fix-gcc-constexpr-lambda \
--merge-branch ivoitovych/tt-metal:ivoitovych/issue-37922-fix-gcc-self-referential-using \
--tt-train-compiler gcc-12
# Build 2: default compiler (clang-20 inherited from tt-metal CMakeCache.txt)
./build_tt_docker.sh --branch main \
--merge-branch ivoitovych/issue-36993-fix-gcc-constexpr-lambda \
--merge-branch ivoitovych/tt-metal:ivoitovych/issue-37922-fix-gcc-self-referential-using |
16 tasks
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.
Ticket
Fixes #37922
Problem description
5 tt-train device operation headers use self-referential
usingtype alias declarations:This violates C++ [basic.scope.class]/2: the member name on the left shadows the namespace-scope type on the right, making the declaration self-referential. GCC (all versions) correctly rejects this with
-fpermissive; Clang is lenient and accepts it.8 other device operations in the same codebase already use the correct fully-qualified pattern.
What's changed
Added full namespace qualification to the
usingdeclarations in the 5 affected files, matching the pattern already used by rmsnorm_fw, rmsnorm_bw, softmax, silu_bw, cross_entropy_fw, cross_entropy_bw, sdpa_fw, and profiler_no_op.Before (broken with GCC)
After (works with both GCC and Clang)
Files changed (5 files, 20 lines)
tt-train/sources/ttml/metal/ops/layernorm_fw/device/layernorm_fw_device_operation.hpptt-train/sources/ttml/metal/ops/layernorm_bw/device/layernorm_bw_device_operation.hpptt-train/sources/ttml/metal/ops/swiglu_fw/device/swiglu_fw_device_operation.hpptt-train/sources/ttml/metal/optimizers/adamw/device/adamw_device_operation.hpptt-train/sources/ttml/metal/optimizers/sgd_fused/device/sgd_fused_device_operation.hppVerification
Container build with
--tt-train-compiler gcc-12merging this fix + PR #37166 (compiler selection) on top of main — verifies tt-train compiles successfully with GCC 12.Checklist
Model tests
If your changes cover model-related code, you should run tests corresponding to affected models and platforms (Single card, T3K, Galaxy). "Choose your pipeline" workflows facilitate running multiple kinds of tests in a single run. Each offers
models-mandatoryandmodels-extendedpresets.The former includes a minimal set of tests, to be run always. The latter extends that with additional ones - use your best judgement in deciding which is the most appropriate for your PR.
models-mandatorypreset (runs: Device perf regressions and Frequent model and ttnn tests)models-extendedpreset (runs: the mandatory tests, plus Demo and Model perf tests)models-mandatorypreset (runs: Unit tests)models-extendedpreset (runs: the mandatory tests, plus Demo and Model perf tests)models-mandatorypreset (runs: Quick tests)models-extendedpreset (runs: the mandatory tests, plus Demo and Model perf tests)