13 #ifndef MLIR_DIALECT_SPIRV_IR_TARGETANDABI_H
14 #define MLIR_DIALECT_SPIRV_IR_TARGETANDABI_H
18 #include "llvm/ADT/SmallSet.h"
25 enum class StorageClass : uint32_t;
33 Version getVersion()
const;
48 Vendor getVendorID()
const;
51 DeviceType getDeviceType()
const;
54 uint32_t getDeviceID()
const;
60 ResourceLimitsAttr getResourceLimits()
const;
69 llvm::SmallSet<Extension, 4> givenExtensions;
70 llvm::SmallSet<Capability, 8> givenCapabilities;
79 std::optional<StorageClass> storageClass,
96 std::optional<int> subgroupSize = {},
97 std::optional<int> targetWidth = {});
130 bool use64bitAddress);
static MLIRContext * getContext(OpFoldResult val)
MLIRContext is the top-level object for a collection of MLIR operations.
An attribute that specifies the target version, allowed extensions and capabilities,...
A wrapper class around a spirv::TargetEnvAttr to provide query methods for allowed version/capabiliti...
std::optional< Capability > allows(ArrayRef< Capability >) const
Returns the first allowed one if any of the given capabilities is allowed.
bool allows(Extension) const
Returns true if the given extension is allowed.
std::optional< Extension > allows(ArrayRef< Extension >) const
Returns the first allowed one if any of the given extensions is allowed.
bool allows(Capability) const
Returns true if the given capability is allowed.
TargetEnvAttr getAttr() const
StringRef getInterfaceVarABIAttrName()
Returns the attribute name for specifying argument ABI information.
bool needsInterfaceVarABIAttrs(TargetEnvAttr targetAttr)
Returns whether the given SPIR-V target (described by TargetEnvAttr) needs ABI attributes for interfa...
TargetEnvAttr lookupTargetEnvOrDefault(Operation *op)
Queries the target environment recursively from enclosing symbol table ops containing the given op or...
InterfaceVarABIAttr getInterfaceVarABIAttr(unsigned descriptorSet, unsigned binding, std::optional< StorageClass > storageClass, MLIRContext *context)
Gets the InterfaceVarABIAttr given its fields.
EntryPointABIAttr lookupEntryPointABI(Operation *op)
Queries the entry point ABI on the nearest function-like op containing the given op.
EntryPointABIAttr getEntryPointABIAttr(MLIRContext *context, ArrayRef< int32_t > workgroupSize={}, std::optional< int > subgroupSize={}, std::optional< int > targetWidth={})
Gets the EntryPointABIAttr given its fields.
TargetEnvAttr lookupTargetEnv(Operation *op)
Queries the target environment recursively from enclosing symbol table ops containing the given op.
StringRef getTargetEnvAttrName()
Returns the attribute name for specifying SPIR-V target environment.
DenseI32ArrayAttr lookupLocalWorkGroupSize(Operation *op)
Queries the local workgroup size from entry point ABI on the nearest function-like op containing the ...
AddressingModel getAddressingModel(TargetEnvAttr targetAttr, bool use64bitAddress)
Returns addressing model selected based on target environment.
FailureOr< ExecutionModel > getExecutionModel(TargetEnvAttr targetAttr)
Returns execution model selected based on target environment.
FailureOr< MemoryModel > getMemoryModel(TargetEnvAttr targetAttr)
Returns memory model selected based on target environment.
ResourceLimitsAttr getDefaultResourceLimits(MLIRContext *context)
Returns a default resource limits attribute that uses numbers from "Table 46. Required Limits" of the...
TargetEnvAttr getDefaultTargetEnv(MLIRContext *context)
Returns the default target environment: SPIR-V 1.0 with Shader capability and no extra extensions.
StringRef getEntryPointABIAttrName()
Returns the attribute name for specifying entry point information.
Include the generated interface declarations.
detail::DenseArrayAttrImpl< int32_t > DenseI32ArrayAttr