[mlir][spirv] Add a field for client API in target environment
authorLei Zhang <antiagainst@google.com>
Fri, 25 Nov 2022 21:31:12 +0000 (21:31 +0000)
committerLei Zhang <antiagainst@google.com>
Fri, 25 Nov 2022 21:38:00 +0000 (21:38 +0000)
commite672f5126fcfca650534ee5fd81425df36c76eb6
tree11aa0f6263c2011bc94c0d054fcc2302c02036b6
parent410c1f6269779a01ad24909974eafb0f2e8d8cac
[mlir][spirv] Add a field for client API in target environment

SPIR-V can be directly consumed by APIs like Vulkan and OpenCL,
where we can use the capability list to diffferentiate. It can
also be used as a compilation target to transcompile to shading
languages like WGSL to target WebGPU. We have no way to tell
that with just the capability list, so we cannot perform certain
transformations only applicable to those targets thus far. So
this commit add a field in the target environment to indicate
the client API for such purposes.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D138732
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVAttributes.h
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp
mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp
mlir/test/Dialect/SPIRV/IR/target-and-abi.mlir