Skip to content

Commit 6b0e4b6

Browse files
aratajewigcbot
authored andcommitted
Support isProductChildOf in IGCCSPIRVSupportTblGen
Support `isProductChildOf` in `IGCCSPIRVSupportTblGen`
1 parent 776bd7a commit 6b0e4b6

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

IGC/AdaptorOCL/Utils/IGCCSPIRVSupportTblGen/IGCCSPIRVPlatformSupport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ enum class PlatformSupportKind {
3333
NotSupported,
3434
InheritFromExtension,
3535
CoreChildOf,
36+
ProductChildOf,
3637
ExactPlatform,
3738
InGroup,
3839
AnyOf,
@@ -69,6 +70,8 @@ inline PlatformSupportKind classifyPlatformSupport(const Record *R) {
6970
return PlatformSupportKind::InheritFromExtension;
7071
if (R->isSubClassOf("isCoreChildOf"))
7172
return PlatformSupportKind::CoreChildOf;
73+
if (R->isSubClassOf("isProductChildOf"))
74+
return PlatformSupportKind::ProductChildOf;
7275
if (R->isSubClassOf("ExactPlatform"))
7376
return PlatformSupportKind::ExactPlatform;
7477
if (R->isSubClassOf("isInGroup"))

IGC/AdaptorOCL/Utils/IGCCSPIRVSupportTblGen/IGCCSPIRVSupportTblGen.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ void SPIRVSupportDocsEmitter::accumulatePlatformTokens(const Record *Support, st
147147
Tokens.insert(Token);
148148
return;
149149
}
150+
case PlatformSupportKind::ProductChildOf: {
151+
const Record *BasePlatform = Support->getValueAsDef("BasePlatform");
152+
std::string Token = (BasePlatform->getValueAsString("ProductFamily") + StringRef(" and newer")).str();
153+
Tokens.insert(Token);
154+
return;
155+
}
150156
case PlatformSupportKind::ExactPlatform: {
151157
const Record *Plat = Support->getValueAsDef("TargetPlatform");
152158
std::string Token = Plat->getValueAsString("ProductFamily").str();
@@ -219,6 +225,10 @@ void SPIRVSupportQueriesEmitter::emitSPIRVExtensionStructures(raw_ostream &OS) {
219225
OS << "inline bool isCoreChildOf(PLATFORM Platform, GFXCORE_FAMILY Core) {\n";
220226
OS << " return Platform.eRenderCoreFamily >= Core;\n";
221227
OS << "}\n\n";
228+
OS << "// Helper function for product family hierarchy checks\n";
229+
OS << "inline bool isProductChildOf(PLATFORM Platform, PRODUCT_FAMILY Product) {\n";
230+
OS << " return Platform.eProductFamily >= Product;\n";
231+
OS << "}\n\n";
222232
OS << "// SPIR-V Extension and Capability structures\n";
223233
OS << "struct SPIRVCapability {\n";
224234
OS << " std::string Name;\n";
@@ -360,6 +370,11 @@ std::string SPIRVSupportQueriesEmitter::buildPredicate(const Record *Support, St
360370
StringRef BaseRenderCoreFamily = BaseCore->getValueAsString("RenderCoreFamily");
361371
return (Twine("isCoreChildOf(" + PlatformVar + ", ") + BaseRenderCoreFamily + ")").str();
362372
}
373+
case PlatformSupportKind::ProductChildOf: {
374+
const Record *BasePlatform = Support->getValueAsDef("BasePlatform");
375+
StringRef BaseProductFamily = BasePlatform->getValueAsString("ProductFamily");
376+
return (Twine("isProductChildOf(" + PlatformVar + ", ") + BaseProductFamily + ")").str();
377+
}
363378
case PlatformSupportKind::ExactPlatform: {
364379
const Record *Platform = Support->getValueAsDef("TargetPlatform");
365380
StringRef ProductFamily = Platform->getValueAsString("ProductFamily");

IGC/AdaptorOCL/ocl_igc_interface/extensions/SPIRVExtensions_Common.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ class isCoreChildOf<CoreFamily baseCore> : PlatformSupport {
9494
CoreFamily BaseCore = baseCore;
9595
}
9696

97+
class isProductChildOf<Platform basePlatform> : PlatformSupport {
98+
Platform BasePlatform = basePlatform;
99+
}
100+
97101
class ExactPlatform<Platform platform> : PlatformSupport {
98102
Platform TargetPlatform = platform;
99103
}

0 commit comments

Comments
 (0)