13 #ifndef MLIR_DIALECT_SPIRV_IR_SPIRVATTRIBUTES_H
14 #define MLIR_DIALECT_SPIRV_IR_SPIRVATTRIBUTES_H
27 #define GET_ATTRDEF_CLASSES
28 #include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h.inc"
32 enum class Capability : uint32_t;
33 enum class DeviceType : uint32_t;
34 enum class Extension : uint32_t;
35 enum class Vendor : uint32_t;
36 enum class Version : uint32_t;
50 #include "mlir/Dialect/SPIRV/IR/SPIRVAttrUtils.inc"
56 detail::InterfaceVarABIAttributeStorage> {
62 std::optional<StorageClass> storageClass,
65 IntegerAttr storageClass);
80 IntegerAttr descriptorSet, IntegerAttr binding,
81 IntegerAttr storageClass);
83 static constexpr StringLiteral
name =
"spirv.interface_var_abi";
90 detail::VerCapExtAttributeStorage> {
99 ArrayAttr extensions);
108 :
public llvm::mapped_iterator<ArrayAttr::iterator,
109 Extension (*)(Attribute)> {
120 :
public llvm::mapped_iterator<ArrayAttr::iterator,
121 Capability (*)(Attribute)> {
132 IntegerAttr version, ArrayAttr capabilities,
133 ArrayAttr extensions);
135 static constexpr StringLiteral
name =
"spirv.ver_cap_ext";
143 detail::TargetEnvAttributeStorage> {
152 ClientAPI clientAPI = ClientAPI::Unknown,
153 Vendor vendorID = Vendor::Unknown,
154 DeviceType deviceType = DeviceType::Unknown,
191 static constexpr StringLiteral
name =
"spirv.target_env";
This class represents a diagnostic that is inflight and set to be reported.
MLIRContext is the top-level object for a collection of MLIR operations.
Utility class for implementing users of storage classes uniqued by a StorageUniquer.
An attribute that specifies the information regarding the interface variable: descriptor set,...
uint32_t getBinding()
Returns binding.
static StringRef getKindName()
Returns the attribute kind's name (without the 'spirv.' prefix).
static constexpr StringLiteral name
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, IntegerAttr descriptorSet, IntegerAttr binding, IntegerAttr storageClass)
uint32_t getDescriptorSet()
Returns descriptor set.
static InterfaceVarABIAttr get(uint32_t descriptorSet, uint32_t binding, std::optional< StorageClass > storageClass, MLIRContext *context)
Gets a InterfaceVarABIAttr.
std::optional< StorageClass > getStorageClass()
Returns spirv::StorageClass.
An attribute that specifies the target version, allowed extensions and capabilities,...
Version getVersion() const
Returns the target version.
VerCapExtAttr::cap_range getCapabilities()
Returns the target capabilities.
ResourceLimitsAttr getResourceLimits() const
Returns the target resource limits.
static StringRef getKindName()
Returns the attribute kind's name (without the 'spirv.' prefix).
VerCapExtAttr getTripleAttr() const
Returns the (version, capabilities, extensions) triple attribute.
ArrayAttr getCapabilitiesAttr()
Returns the target capabilities as an integer array attribute.
VerCapExtAttr::ext_range getExtensions()
Returns the target extensions.
static constexpr StringLiteral name
Vendor getVendorID() const
Returns the vendor ID.
DeviceType getDeviceType() const
Returns the device type.
ClientAPI getClientAPI() const
Returns the client API.
ArrayAttr getExtensionsAttr()
Returns the target extensions as a string array attribute.
uint32_t getDeviceID() const
Returns the device ID.
static constexpr uint32_t kUnknownDeviceID
ID for unknown devices.
static TargetEnvAttr get(VerCapExtAttr triple, ResourceLimitsAttr limits, ClientAPI clientAPI=ClientAPI::Unknown, Vendor vendorID=Vendor::Unknown, DeviceType deviceType=DeviceType::Unknown, uint32_t deviceId=kUnknownDeviceID)
Gets a TargetEnvAttr instance.
An attribute that specifies the SPIR-V (version, capabilities, extensions) triple.
cap_range getCapabilities()
Returns the capabilities.
static LogicalResult verify(function_ref< InFlightDiagnostic()> emitError, IntegerAttr version, ArrayAttr capabilities, ArrayAttr extensions)
Version getVersion()
Returns the version.
static StringRef getKindName()
Returns the attribute kind's name (without the 'spirv.' prefix).
static VerCapExtAttr get(Version version, ArrayRef< Capability > capabilities, ArrayRef< Extension > extensions, MLIRContext *context)
Gets a VerCapExtAttr instance.
ArrayAttr getCapabilitiesAttr()
Returns the capabilities as an integer array attribute.
static constexpr StringLiteral name
ext_range getExtensions()
Returns the extensions.
ArrayAttr getExtensionsAttr()
Returns the extensions as a string array attribute.
Include the generated interface declarations.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
This class represents an efficient way to signal success or failure.
cap_iterator(ArrayAttr::iterator it)
ext_iterator(ArrayAttr::iterator it)