Skip to content

[NFC][AMDGPU][Attributor] Exit earlier if entry CC #114177

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

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,17 @@ struct AAAMDFlatWorkGroupSize : public AAAMDSizeRangeAttribute {

void initialize(Attributor &A) override {
Function *F = getAssociatedFunction();

if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
indicatePessimisticFixpoint();
return;
}

auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
unsigned MinGroupSize, MaxGroupSize;
std::tie(MinGroupSize, MaxGroupSize) = InfoCache.getFlatWorkGroupSizes(*F);
intersectKnown(
ConstantRange(APInt(32, MinGroupSize), APInt(32, MaxGroupSize + 1)));

if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
indicatePessimisticFixpoint();
}

ChangeStatus updateImpl(Attributor &A) override {
Expand Down Expand Up @@ -833,6 +836,12 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {

void initialize(Attributor &A) override {
Function *F = getAssociatedFunction();

if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
indicatePessimisticFixpoint();
return;
}

auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());

if (const auto *AssumedGroupSize = A.getAAFor<AAAMDFlatWorkGroupSize>(
Expand All @@ -847,9 +856,6 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {
ConstantRange Range(APInt(32, Min), APInt(32, Max + 1));
intersectKnown(Range);
}

if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
indicatePessimisticFixpoint();
}

ChangeStatus updateImpl(Attributor &A) override {
Expand Down
Loading