shader: Document and relax cache control on surface instructions

This commit is contained in:
ReinUsesLisp 2021-04-13 06:11:18 -03:00 committed by ameerj
parent fa75b9b062
commit 09165ae189

View File

@ -61,18 +61,19 @@ enum class Clamp : u64 {
TRAP, TRAP,
}; };
// https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#cache-operators
enum class LoadCache : u64 { enum class LoadCache : u64 {
Default, CA, // Cache at all levels, likely to be accessed again
CG, CG, // Cache at global level (L2 and below, not L1)
CI, CI, // ???
CV, CV, // Don't cache and fetch again (volatile)
}; };
enum class StoreCache : u64 { enum class StoreCache : u64 {
Default, WB, // Cache write-back all coherent levels
CG, CG, // Cache at global level (L2 and below, not L1)
CS, CS, // Cache streaming, likely to be accessed once
WT, WT, // Cache write-through (to system memory, volatile?)
}; };
ImageFormat Format(Size size) { ImageFormat Format(Size size) {
@ -188,7 +189,7 @@ void TranslatorVisitor::SULD(u64 insn) {
if (suld.clamp != Clamp::IGN) { if (suld.clamp != Clamp::IGN) {
throw NotImplementedException("Clamp {}", suld.clamp.Value()); throw NotImplementedException("Clamp {}", suld.clamp.Value());
} }
if (suld.cache != LoadCache::Default) { if (suld.cache != LoadCache::CA && suld.cache != LoadCache::CG) {
throw NotImplementedException("Cache {}", suld.cache.Value()); throw NotImplementedException("Cache {}", suld.cache.Value());
} }
const bool is_typed{suld.d != 0}; const bool is_typed{suld.d != 0};
@ -248,7 +249,7 @@ void TranslatorVisitor::SUST(u64 insn) {
if (sust.clamp != Clamp::IGN) { if (sust.clamp != Clamp::IGN) {
throw NotImplementedException("Clamp {}", sust.clamp.Value()); throw NotImplementedException("Clamp {}", sust.clamp.Value());
} }
if (sust.cache != StoreCache::Default) { if (sust.cache != StoreCache::WB && sust.cache != StoreCache::CG) {
throw NotImplementedException("Cache {}", sust.cache.Value()); throw NotImplementedException("Cache {}", sust.cache.Value());
} }
const bool is_typed{sust.d != 0}; const bool is_typed{sust.d != 0};