-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[NVPTX] Add prefetch tensormap variant #146203
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
base: main
Are you sure you want to change the base?
Changes from 17 commits
7e3815b
775daa3
aa8e4d0
6931c80
887e139
9ddbcfe
383d07e
0851ae0
9ea1ca3
0d26914
bab560b
f009291
2457b1a
ee0e82c
45f5af0
ec1e1a0
7256bc6
4745db5
1102a58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,12 @@ def AS_match { | |
code global = [{ | ||
return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_GLOBAL); | ||
}]; | ||
code const = [{ | ||
return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_CONST); | ||
}]; | ||
code param = [{ | ||
return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_PARAM); | ||
}]; | ||
} | ||
|
||
// A node that will be replaced with the current PTX version. | ||
|
@@ -744,35 +750,50 @@ foreach dim = [1, 2, 3, 4, 5] in { | |
} | ||
} | ||
|
||
//Prefetch and Prefetchu | ||
//Prefetchu and Prefetch | ||
|
||
class PREFETCH_CONST_CHK<dag frag> | ||
: PatFrag<!setdagop(frag, ops), frag, AS_match.const>; | ||
class PREFETCH_GENERIC_CHK<dag frag> | ||
: PatFrag<!setdagop(frag, ops), frag, AS_match.generic>; | ||
class PREFETCH_PARAM_CHK<dag frag> | ||
: PatFrag<!setdagop(frag, ops), frag, AS_match.param>; | ||
|
||
defvar frag_pat = (int_nvvm_prefetch_tensormap node:$addr); | ||
|
||
def prefetch_tensormap_const : PREFETCH_CONST_CHK<frag_pat>; | ||
def prefetch_tensormap_gen : PREFETCH_GENERIC_CHK<frag_pat>; | ||
def prefetch_tensormap_param : PREFETCH_PARAM_CHK<frag_pat>; | ||
|
||
class PREFETCH_INTRS<string InstName> : | ||
def PREFETCH_CONST_TENSORMAP : NVPTXInst<(outs), (ins ADDR:$addr), | ||
"prefetch.const.tensormap [$addr];", | ||
[(prefetch_tensormap_const addr:$addr)]>; | ||
|
||
def PREFETCH_GENERIC_TENSORMAP : NVPTXInst<(outs), (ins ADDR:$addr), | ||
"prefetch.tensormap [$addr];", | ||
[(prefetch_tensormap_gen addr:$addr)]>; | ||
|
||
def PREFETCH_PARAM_TENSORMAP : NVPTXInst<(outs), (ins ADDR:$addr), | ||
"prefetch.param.tensormap [$addr];", | ||
abhilash1910 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[(prefetch_tensormap_param addr:$addr)]>; | ||
|
||
|
||
class PREFETCH_INTRS<string InstName, Intrinsic Intr> : | ||
BasicNVPTXInst<(outs), (ins ADDR:$addr), | ||
InstName, | ||
[(!cast<Intrinsic>(!strconcat("int_nvvm_", | ||
!subst(".", "_", InstName))) addr:$addr)]>, | ||
Requires<[hasPTX<80>, hasSM<90>]>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have these predicates been removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this needs to be added, fixing in progress. Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this been fixed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed this, will update. thanks |
||
|
||
|
||
def PREFETCH_L1 : PREFETCH_INTRS<"prefetch.L1">; | ||
def PREFETCH_L2 : PREFETCH_INTRS<"prefetch.L2">; | ||
def PREFETCH_GLOBAL_L1 : PREFETCH_INTRS<"prefetch.global.L1">; | ||
def PREFETCH_LOCAL_L1 : PREFETCH_INTRS<"prefetch.local.L1">; | ||
def PREFETCH_GLOBAL_L2 : PREFETCH_INTRS<"prefetch.global.L2">; | ||
def PREFETCH_LOCAL_L2 : PREFETCH_INTRS<"prefetch.local.L2">; | ||
|
||
def PREFETCH_GLOBAL_L2_EVICT_NORMAL : BasicNVPTXInst<(outs), (ins ADDR:$addr), | ||
"prefetch.global.L2::evict_normal", | ||
[(int_nvvm_prefetch_global_L2_evict_normal addr:$addr)]>, | ||
Requires<[hasPTX<80>, hasSM<90>]>; | ||
|
||
def PREFETCH_GLOBAL_L2_EVICT_LAST : BasicNVPTXInst<(outs), (ins ADDR:$addr), | ||
"prefetch.global.L2::evict_last", | ||
[(int_nvvm_prefetch_global_L2_evict_last addr:$addr)]>, | ||
Requires<[hasPTX<80>, hasSM<90>]>; | ||
|
||
|
||
def PREFETCHU_L1 : PREFETCH_INTRS<"prefetchu.L1">; | ||
[(Intr addr:$addr)]>; | ||
|
||
def PREFETCHU_L1 : PREFETCH_INTRS<"prefetchu.L1", int_nvvm_prefetchu_L1>; | ||
def PREFETCH_L1 : PREFETCH_INTRS<"prefetch.L1", int_nvvm_prefetch_L1>; | ||
def PREFETCH_L2 : PREFETCH_INTRS<"prefetch.L2", int_nvvm_prefetch_L2>; | ||
def PREFETCH_GLOBAL_L1 : PREFETCH_INTRS<"prefetch.global.L1", int_nvvm_prefetch_global_L1>; | ||
def PREFETCH_LOCAL_L1 : PREFETCH_INTRS<"prefetch.local.L1", int_nvvm_prefetch_local_L1>; | ||
def PREFETCH_GLOBAL_L2 : PREFETCH_INTRS<"prefetch.global.L2", int_nvvm_prefetch_global_L2>; | ||
def PREFETCH_LOCAL_L2 : PREFETCH_INTRS<"prefetch.local.L2", int_nvvm_prefetch_local_L2>; | ||
def PREFETCH_GLOBAL_L2_EVICT_NORMAL : PREFETCH_INTRS<"prefetch.global.L2::evict_normal", | ||
int_nvvm_prefetch_global_L2_evict_normal>; | ||
def PREFETCH_GLOBAL_L2_EVICT_LAST : PREFETCH_INTRS<"prefetch.global.L2::evict_last", | ||
int_nvvm_prefetch_global_L2_evict_last>; | ||
|
||
//Applypriority intrinsics | ||
class APPLYPRIORITY_L2_INTRS<string addrspace> : | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -564,7 +564,8 @@ bool NVPTXTTIImpl::collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes, | |
case Intrinsic::nvvm_isspacep_global: | ||
case Intrinsic::nvvm_isspacep_local: | ||
case Intrinsic::nvvm_isspacep_shared: | ||
case Intrinsic::nvvm_isspacep_shared_cluster: { | ||
case Intrinsic::nvvm_isspacep_shared_cluster: | ||
case Intrinsic::nvvm_prefetch_tensormap: { | ||
OpIndexes.push_back(0); | ||
return true; | ||
} | ||
|
@@ -587,6 +588,9 @@ Value *NVPTXTTIImpl::rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, | |
return ConstantInt::get(II->getType(), *R); | ||
return nullptr; | ||
} | ||
case Intrinsic::nvvm_prefetch_tensormap: { | ||
return nullptr; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In order for this to be useful we need to actually rewrite the intrinsic here. That is, create an |
||
} | ||
} | ||
return nullptr; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.