This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] [NFC] refactor the AMDGPU attributor
ClosedPublic

Authored by sameerds on Feb 6 2022, 9:55 AM.

Diff Detail

Event Timeline

sameerds created this revision.Feb 6 2022, 9:55 AM
sameerds requested review of this revision.Feb 6 2022, 9:55 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
arsenm added inline comments.Feb 7 2022, 6:20 AM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
413

Lost the comment?

465–466

Reword comment to negate?

sameerds added inline comments.Feb 7 2022, 7:52 AM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
413

The "nothing else to do" refers to the rest of the function body, which got moved into checkForQueuePtr(). The short-circuiting logical-or before calling this function is the same thing now.

465–466

Not really. "nothing else to do" simply means "return early" here.

arsenm added inline comments.Feb 7 2022, 8:02 AM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
465–466

amdgpu-queue-ptr isn't an attribute, amdgpu-no-queue-ptr

sameerds added inline comments.Feb 7 2022, 8:12 AM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
465–466

Ah, I see. Just like the comment before this one, it is actually referring to "the queue pointer" and not the attribute. I didn't write this code ... git is confused about code that got moved up/down. There are multiple places in this file that still talk about "needs a queue ptr attribute" in the positive sense. Might be good to clean that up separately.

This patch merely moves stuff around and converts the hard-coded mask bits into those generated from enums.

sameerds updated this revision to Diff 406528.Feb 7 2022, 11:00 AM

Fixed stale comments that mention the attribute amdgpu-queue-ptr in the positive sense.

arsenm accepted this revision.Feb 7 2022, 11:13 AM
This revision is now accepted and ready to land.Feb 7 2022, 11:13 AM
This revision was landed with ongoing or failed builds.Feb 7 2022, 6:46 PM
This revision was automatically updated to reflect the committed changes.
cfang added a subscriber: cfang.Feb 8 2022, 3:28 PM
cfang added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
400

I don't think we need to checkForQueuePtr when NeedsQueuePtr is
true.

sameerds added inline comments.Feb 8 2022, 5:56 PM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
400

Indeed. I am relying on the short-circuiting nature of the logical-or to achieve that.

sameerds added inline comments.Feb 8 2022, 7:15 PM
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
400

Turns out that this is actually the bitwise operator and it is not short-circuiting. Fixed in D119308. Thanks for catching this!