This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Implement llvm.get.rounding
ClosedPublic

Authored by arsenm on Jun 16 2023, 10:44 AM.

Details

Reviewers
foad
rampitec
b-sumner
Pierre-vh
cdevadas
jhuber6
Group Reviewers
Restricted Project
Summary

There are really two rounding modes, so only return the standard
values if both modes are the same. Otherwise, return a bitmask
representing the two modes.

Annoyingly the register doesn't use the same values as FLT_ROUNDS. Use
a simple integer table we can shift into to convert.

Diff Detail

Event Timeline

arsenm created this revision.Jun 16 2023, 10:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2023, 10:44 AM
arsenm requested review of this revision.Jun 16 2023, 10:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2023, 10:44 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 532235.Jun 16 2023, 10:56 AM

Fix wrong comment

arsenm planned changes to this revision.Jun 17 2023, 2:40 PM
arsenm updated this revision to Diff 532585.Jun 19 2023, 3:27 AM

Don't treat extended values as bitmask since this made the inverse more difficult

rampitec added inline comments.Jul 17 2023, 10:16 AM
llvm/docs/AMDGPUUsage.rst
981

Merge leftover

Now that D153084 is submitted, could you please rebase it?

llvm/docs/AMDGPUUsage.rst
4883

Nit: being a bitmask it would be more readable in hex.

arsenm updated this revision to Diff 546276.Aug 1 2023, 5:26 PM

Fix diff

ping (although much of the complexity will go away if the ABI changes in D156989

rampitec accepted this revision.Aug 30 2023, 10:32 AM
This revision is now accepted and ready to land.Aug 30 2023, 10:32 AM

This change appears to have broken the Windows MLIR bot, I'm unclear why other Windows bots are broken, maybe AMDGPU isn't on? Thanks for taking a look! https://lab.llvm.org/buildbot/#/builders/13/builds/39545/steps/6/logs/stdio

C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(80): error C2370: 'llvm::AMDGPU::FltRoundConversionTable': redefinition; different storage class
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.h(143): note: see declaration of 'llvm::AMDGPU::FltRoundConversionTable'
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(121): error C2131: expression did not evaluate to a constant
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(69): note: failure was caused by non-constant arguments or reference to a non-constant symbol
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(69): note: see usage of 'llvm::AMDGPU::FltRoundConversionTable'

This change appears to have broken the Windows MLIR bot, I'm unclear why other Windows bots are broken, maybe AMDGPU isn't on? Thanks for taking a look! https://lab.llvm.org/buildbot/#/builders/13/builds/39545/steps/6/logs/stdio

C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(80): error C2370: 'llvm::AMDGPU::FltRoundConversionTable': redefinition; different storage class
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.h(143): note: see declaration of 'llvm::AMDGPU::FltRoundConversionTable'
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(121): error C2131: expression did not evaluate to a constant
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(69): note: failure was caused by non-constant arguments or reference to a non-constant symbol
C:\buildbot\mlir-x64-windows-ninja\llvm-project\llvm\lib\Target\AMDGPU\SIModeRegisterDefaults.cpp(69): note: see usage of 'llvm::AMDGPU::FltRoundConversionTable'

Trying 003cf293f632a25c58bc68d130a313454166dd0a