Skip to content

Commit 95d70a9

Browse files
authored
Remove internal values for SPV_INTEL_cache_controls (#2346)
The Headers for this extension were published so we should use them instead: KhronosGroup/SPIRV-Headers@a8af2ce
1 parent fc9896b commit 95d70a9

File tree

5 files changed

+34
-60
lines changed

5 files changed

+34
-60
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,7 +2809,7 @@ static void transMetadataDecorations(Metadata *MD, SPIRVEntry *Target) {
28092809
break;
28102810
}
28112811

2812-
case spv::internal::DecorationCacheControlLoadINTEL: {
2812+
case DecorationCacheControlLoadINTEL: {
28132813
ErrLog.checkError(
28142814
NumOperands == 3, SPIRVEC_InvalidLlvmModule,
28152815
"CacheControlLoadINTEL requires exactly 2 extra operands");
@@ -2826,11 +2826,10 @@ static void transMetadataDecorations(Metadata *MD, SPIRVEntry *Target) {
28262826

28272827
Target->addDecorate(new SPIRVDecorateCacheControlLoadINTEL(
28282828
Target, CacheLevel->getZExtValue(),
2829-
static_cast<internal::LoadCacheControlINTEL>(
2830-
CacheControl->getZExtValue())));
2829+
static_cast<LoadCacheControl>(CacheControl->getZExtValue())));
28312830
break;
28322831
}
2833-
case spv::internal::DecorationCacheControlStoreINTEL: {
2832+
case DecorationCacheControlStoreINTEL: {
28342833
ErrLog.checkError(
28352834
NumOperands == 3, SPIRVEC_InvalidLlvmModule,
28362835
"CacheControlStoreINTEL requires exactly 2 extra operands");
@@ -2847,8 +2846,7 @@ static void transMetadataDecorations(Metadata *MD, SPIRVEntry *Target) {
28472846

28482847
Target->addDecorate(new SPIRVDecorateCacheControlStoreINTEL(
28492848
Target, CacheLevel->getZExtValue(),
2850-
static_cast<internal::StoreCacheControlINTEL>(
2851-
CacheControl->getZExtValue())));
2849+
static_cast<StoreCacheControl>(CacheControl->getZExtValue())));
28522850
break;
28532851
}
28542852
default: {
@@ -3304,8 +3302,7 @@ AnnotationDecorations tryParseAnnotationString(SPIRVModule *BM,
33043302
Decorates.LatencyControlVec.emplace_back(
33053303
static_cast<Decoration>(DecorationKind), std::move(DecValues));
33063304
} else if (AllowCacheControls &&
3307-
DecorationKind ==
3308-
internal::DecorationCacheControlLoadINTEL) {
3305+
DecorationKind == DecorationCacheControlLoadINTEL) {
33093306
Decorates.CacheControlVec.emplace_back(
33103307
static_cast<Decoration>(DecorationKind), std::move(DecValues));
33113308
} else if (DecorationKind == DecorationMemoryINTEL) {
@@ -3566,7 +3563,7 @@ void addAnnotationDecorations(SPIRVEntry *E, DecorationsInfoVec &Decorations) {
35663563
}
35673564
break;
35683565
}
3569-
case spv::internal::DecorationCacheControlLoadINTEL: {
3566+
case DecorationCacheControlLoadINTEL: {
35703567
if (M->isAllowedToUseExtension(ExtensionID::SPV_INTEL_cache_controls)) {
35713568
M->getErrorLog().checkError(
35723569
I.second.size() == 2, SPIRVEC_InvalidLlvmModule,
@@ -3576,8 +3573,7 @@ void addAnnotationDecorations(SPIRVEntry *E, DecorationsInfoVec &Decorations) {
35763573
StringRef(I.second[0]).getAsInteger(10, CacheLevel);
35773574
StringRef(I.second[1]).getAsInteger(10, CacheControl);
35783575
E->addDecorate(new SPIRVDecorateCacheControlLoadINTEL(
3579-
E, CacheLevel,
3580-
static_cast<internal::LoadCacheControlINTEL>(CacheControl)));
3576+
E, CacheLevel, static_cast<LoadCacheControl>(CacheControl)));
35813577
}
35823578
}
35833579

lib/SPIRV/libSPIRV/SPIRVDecorate.h

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ class SPIRVDecorate : public SPIRVDecorateGeneric {
214214
return ExtensionID::SPV_INTEL_fpga_latency_control;
215215
case DecorationFPMaxErrorDecorationINTEL:
216216
return ExtensionID::SPV_INTEL_fp_max_error;
217-
case internal::DecorationCacheControlLoadINTEL:
218-
case internal::DecorationCacheControlStoreINTEL:
217+
case DecorationCacheControlLoadINTEL:
218+
case DecorationCacheControlStoreINTEL:
219219
return ExtensionID::SPV_INTEL_cache_controls;
220220
default:
221221
return {};
@@ -932,32 +932,31 @@ class SPIRVDecorateImplementInRegisterMapINTEL : public SPIRVDecorate {
932932
class SPIRVDecorateCacheControlLoadINTEL : public SPIRVDecorate {
933933
public:
934934
// Complete constructor for SPIRVDecorateCacheControlLoadINTEL
935-
SPIRVDecorateCacheControlLoadINTEL(
936-
SPIRVEntry *TheTarget, SPIRVWord CacheLevel,
937-
spv::internal::LoadCacheControlINTEL CacheControl)
938-
: SPIRVDecorate(spv::internal::DecorationCacheControlLoadINTEL, TheTarget,
939-
CacheLevel, static_cast<SPIRVWord>(CacheControl)){};
935+
SPIRVDecorateCacheControlLoadINTEL(SPIRVEntry *TheTarget,
936+
SPIRVWord CacheLevel,
937+
LoadCacheControl CacheControl)
938+
: SPIRVDecorate(DecorationCacheControlLoadINTEL, TheTarget, CacheLevel,
939+
static_cast<SPIRVWord>(CacheControl)) {}
940940

941-
SPIRVWord getCacheLevel() const { return Literals.at(0); };
942-
spv::internal::LoadCacheControlINTEL getCacheControl() const {
943-
return static_cast<spv::internal::LoadCacheControlINTEL>(Literals.at(1));
944-
};
941+
SPIRVWord getCacheLevel() const { return Literals.at(0); }
942+
LoadCacheControl getCacheControl() const {
943+
return static_cast<LoadCacheControl>(Literals.at(1));
944+
}
945945
};
946946

947947
class SPIRVDecorateCacheControlStoreINTEL : public SPIRVDecorate {
948948
public:
949949
// Complete constructor for SPIRVDecorateCacheControlStoreINTEL
950-
SPIRVDecorateCacheControlStoreINTEL(
951-
SPIRVEntry *TheTarget, SPIRVWord CacheLevel,
952-
spv::internal::StoreCacheControlINTEL CacheControl)
953-
: SPIRVDecorate(spv::internal::DecorationCacheControlStoreINTEL,
954-
TheTarget, CacheLevel,
955-
static_cast<SPIRVWord>(CacheControl)){};
956-
957-
SPIRVWord getCacheLevel() const { return Literals.at(0); };
958-
spv::internal::StoreCacheControlINTEL getCacheControl() const {
959-
return static_cast<spv::internal::StoreCacheControlINTEL>(Literals.at(1));
960-
};
950+
SPIRVDecorateCacheControlStoreINTEL(SPIRVEntry *TheTarget,
951+
SPIRVWord CacheLevel,
952+
StoreCacheControl CacheControl)
953+
: SPIRVDecorate(DecorationCacheControlStoreINTEL, TheTarget, CacheLevel,
954+
static_cast<SPIRVWord>(CacheControl)) {}
955+
956+
SPIRVWord getCacheLevel() const { return Literals.at(0); }
957+
StoreCacheControl getCacheControl() const {
958+
return static_cast<StoreCacheControl>(Literals.at(1));
959+
}
961960
};
962961

963962
} // namespace SPIRV

lib/SPIRV/libSPIRV/SPIRVEnum.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,9 @@ template <> inline void SPIRVMap<Decoration, SPIRVCapVec>::init() {
492492
{CapabilityGlobalVariableFPGADecorationsINTEL});
493493
ADD_VEC_INIT(internal::DecorationArgumentAttributeINTEL,
494494
{CapabilityFunctionPointersINTEL});
495-
ADD_VEC_INIT(internal::DecorationCacheControlLoadINTEL,
496-
{internal::CapabilityCacheControlsINTEL});
497-
ADD_VEC_INIT(internal::DecorationCacheControlStoreINTEL,
498-
{internal::CapabilityCacheControlsINTEL});
495+
ADD_VEC_INIT(DecorationCacheControlLoadINTEL, {CapabilityCacheControlsINTEL});
496+
ADD_VEC_INIT(DecorationCacheControlStoreINTEL,
497+
{CapabilityCacheControlsINTEL});
499498
ADD_VEC_INIT(DecorationConduitKernelArgumentINTEL,
500499
{CapabilityFPGAArgumentInterfacesINTEL});
501500
ADD_VEC_INIT(DecorationRegisterMapKernelArgumentINTEL,

lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,16 @@ template <> inline void SPIRVMap<Decoration, std::string>::init() {
208208
add(DecorationInitModeINTEL, "InitModeINTEL");
209209
add(DecorationImplementInRegisterMapINTEL, "ImplementInRegisterMapINTEL");
210210

211+
add(DecorationCacheControlLoadINTEL, "CacheControlLoadINTEL");
212+
add(DecorationCacheControlStoreINTEL, "CacheControlStoreINTEL");
213+
211214
// From spirv_internal.hpp
212215
add(internal::DecorationCallableFunctionINTEL, "CallableFunctionINTEL");
213216
add(internal::DecorationRuntimeAlignedINTEL, "RuntimeAlignedINTEL");
214217
add(internal::DecorationHostAccessINTEL, "HostAccessINTEL");
215218
add(internal::DecorationInitModeINTEL, "InitModeINTEL");
216219
add(internal::DecorationImplementInCSRINTEL, "ImplementInCSRINTEL");
217220
add(internal::DecorationArgumentAttributeINTEL, "ArgumentAttributeINTEL");
218-
add(internal::DecorationCacheControlLoadINTEL, "CacheControlLoadINTEL");
219-
add(internal::DecorationCacheControlStoreINTEL, "CacheControlStoreINTEL");
220221

221222
add(DecorationMax, "Max");
222223
}

lib/SPIRV/libSPIRV/spirv_internal.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ enum InternalDecoration {
9898
IDecInitModeINTEL = 6148,
9999
IDecImplementInCSRINTEL = 6149,
100100
IDecArgumentAttributeINTEL = 6409,
101-
IDecCacheControlLoadINTEL = 6442,
102-
IDecCacheControlStoreINTEL = 6443
103101
};
104102

105103
enum InternalCapability {
@@ -159,21 +157,6 @@ enum InternalBuiltIn {
159157
IBuiltInGlobalHWThreadIDINTEL = 6136,
160158
};
161159

162-
enum class LoadCacheControlINTEL {
163-
Uncached = 0,
164-
Cached = 1,
165-
Streaming = 2,
166-
InvalidateAfterRead = 3,
167-
ConstCached = 4
168-
};
169-
170-
enum class StoreCacheControlINTEL {
171-
Uncached = 0,
172-
WriteThrough = 1,
173-
WriteBack = 2,
174-
Streaming = 3
175-
};
176-
177160
#define _SPIRV_OP(x, y) constexpr x x##y = static_cast<x>(I##x##y);
178161
_SPIRV_OP(Capability, JointMatrixINTEL)
179162
_SPIRV_OP(Capability, JointMatrixWIInstructionsINTEL)
@@ -290,10 +273,6 @@ constexpr Decoration DecorationImplementInCSRINTEL =
290273
static_cast<Decoration>(IDecImplementInCSRINTEL);
291274
constexpr Decoration DecorationArgumentAttributeINTEL =
292275
static_cast<Decoration>(IDecArgumentAttributeINTEL);
293-
constexpr Decoration DecorationCacheControlLoadINTEL =
294-
static_cast<Decoration>(IDecCacheControlLoadINTEL);
295-
constexpr Decoration DecorationCacheControlStoreINTEL =
296-
static_cast<Decoration>(IDecCacheControlStoreINTEL);
297276

298277
constexpr Capability CapabilityFastCompositeINTEL =
299278
static_cast<Capability>(ICapFastCompositeINTEL);

0 commit comments

Comments
 (0)