#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
+#include <iterator>
+
using namespace mlir;
using namespace mlir::spirv;
auto vecSize = getNumElements();
if (vecSize == 8 || vecSize == 16) {
static const Capability caps[] = {Capability::Vector16};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
}
return type.getElementType().cast<ScalarType>().getCapabilities(
Optional<StorageClass> storage) {
getElementType().cast<SPIRVType>().getExtensions(extensions, storage);
static const Extension exts[] = {Extension::SPV_NV_cooperative_matrix};
- ArrayRef<Extension> ref(exts, llvm::array_lengthof(exts));
+ ArrayRef<Extension> ref(exts, std::size(exts));
extensions.push_back(ref);
}
Optional<StorageClass> storage) {
getElementType().cast<SPIRVType>().getCapabilities(capabilities, storage);
static const Capability caps[] = {Capability::CooperativeMatrixNV};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
}
Optional<StorageClass> storage) {
getElementType().cast<SPIRVType>().getExtensions(extensions, storage);
static const Extension exts[] = {Extension::SPV_INTEL_joint_matrix};
- ArrayRef<Extension> ref(exts, llvm::array_lengthof(exts));
+ ArrayRef<Extension> ref(exts, std::size(exts));
extensions.push_back(ref);
}
Optional<StorageClass> storage) {
getElementType().cast<SPIRVType>().getCapabilities(capabilities, storage);
static const Capability caps[] = {Capability::JointMatrixINTEL};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
}
Optional<StorageClass> storage) {
{
static const Capability caps[] = {Capability::Shader};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
}
getElementType().cast<SPIRVType>().getCapabilities(capabilities, storage);
case StorageClass::Uniform:
if (getIntOrFloatBitWidth() == 8) {
static const Extension exts[] = {Extension::SPV_KHR_8bit_storage};
- ArrayRef<Extension> ref(exts, llvm::array_lengthof(exts));
+ ArrayRef<Extension> ref(exts, std::size(exts));
extensions.push_back(ref);
}
[[fallthrough]];
case StorageClass::Output:
if (getIntOrFloatBitWidth() == 16) {
static const Extension exts[] = {Extension::SPV_KHR_16bit_storage};
- ArrayRef<Extension> ref(exts, llvm::array_lengthof(exts));
+ ArrayRef<Extension> ref(exts, std::size(exts));
extensions.push_back(ref);
}
break;
case StorageClass::storage: { \
if (bitwidth == 8) { \
static const Capability caps[] = {Capability::cap8}; \
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps)); \
+ ArrayRef<Capability> ref(caps, std::size(caps)); \
capabilities.push_back(ref); \
return; \
} \
if (bitwidth == 16) { \
static const Capability caps[] = {Capability::cap16}; \
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps)); \
+ ArrayRef<Capability> ref(caps, std::size(caps)); \
capabilities.push_back(ref); \
return; \
} \
case StorageClass::Output: {
if (bitwidth == 16) {
static const Capability caps[] = {Capability::StorageInputOutput16};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
return;
}
#define WIDTH_CASE(type, width) \
case width: { \
static const Capability caps[] = {Capability::type##width}; \
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps)); \
+ ArrayRef<Capability> ref(caps, std::size(caps)); \
capabilities.push_back(ref); \
} break
Optional<StorageClass> storage) {
{
static const Capability caps[] = {Capability::Matrix};
- ArrayRef<Capability> ref(caps, llvm::array_lengthof(caps));
+ ArrayRef<Capability> ref(caps, std::size(caps));
capabilities.push_back(ref);
}
// Add any capabilities associated with the underlying vectors (i.e., columns)