Skip to content

Commit c565971

Browse files
[Intel] Add getAddressSpace to TargetInfo
Signed-off-by: Whitney Tsang <[email protected]>
1 parent e625b79 commit c565971

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

third_party/intel/lib/TritonIntelGPUToLLVM/TargetInfo.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ Value TargetInfo::getStackPointer(RewriterBase &rewriter,
321321
return funcOp.getArgument(funcOp.getNumArguments() - 1);
322322
}
323323

324+
int TargetInfo::getAddressSpace(Attribute addressSpace) const {
325+
int spaceId = 0;
326+
if (isa<triton::gpu::SharedMemorySpaceAttr>(addressSpace)) {
327+
spaceId = 3;
328+
} else {
329+
llvm::report_fatal_error("Only support SharedMemorySpace for now");
330+
}
331+
return spaceId;
332+
}
333+
324334
Value TargetInfo::getGlobalStringStart(Location loc, RewriterBase &rewriter,
325335
StringRef name, StringRef value,
326336
unsigned addressSpace) const {

third_party/intel/lib/TritonIntelGPUToLLVM/TargetInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class TargetInfo : public mlir::triton::TargetInfoBase {
7171
Value getStackPointer(RewriterBase &rewriter,
7272
FunctionOpInterface funcOp) const override;
7373

74+
int getAddressSpace(Attribute addressSpace) const override;
75+
7476
Value getGlobalStringStart(Location loc, RewriterBase &rewriter,
7577
StringRef name, StringRef value,
7678
unsigned addressSpace) const;

0 commit comments

Comments
 (0)