Skip to content

Populate predicate map before any other variable is translated - #256

Open
maarquitos14 wants to merge 5 commits into
ROCm:amd-stagingfrom
maarquitos14:maronas/fix-predicate-map-population
Open

Populate predicate map before any other variable is translated#256
maarquitos14 wants to merge 5 commits into
ROCm:amd-stagingfrom
maarquitos14:maronas/fix-predicate-map-population

Conversation

@maarquitos14

Copy link
Copy Markdown
Contributor

In multi-TU HIP programs we can find __clang_gpu_used_external which appears before llvm.amdgcn.feature.predicate.ids and it recursively triggers function translation which ends up resolving spec constants against an empty FeaturePredicateMap. This patch populates the map before translating any variable.

@maarquitos14
maarquitos14 requested review from AlexVlx and MrSidims July 22, 2026 21:03
Comment thread lib/SPIRV/SPIRVReader.cpp
DbgTran->transDebugInst(EI);
}

// Populate the feature predicate map before translating any variables,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea seems fine but always iterating twice seems not quite ideal. We could consider two things here:

  • change to an associative container;
  • keep the original loop, and only go and do the initialisation either when we encounter the map or for whichever variable comes first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants