[PATCH] D72256: [mlir][spirv] Properly support SPIR-V conversion target

Lei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 05:16:15 PST 2020


antiagainst added a comment.

In D72256#1814529 <https://reviews.llvm.org/D72256#1814529>, @rriddle wrote:

> What are the constraints here?


>From the compiler's point of view, a SPIR-V target environment is mainly specified via three components: version, extensions, and capabilities.  Constraints on them are expressed via verifications on the `TargetEnvAttr`; there are tests for them in this commit. A `TargetEnvAttr` should be attached to the outermost IR unit going through the SPIR-V compilation path.

> Who is populating the target attribute on the module?
>  How is this specified from a hypothetical front-end?

It is expected to be attached by whoever invoking the SPIR-V compilation flow.  Right now I only enabled specifying it via an attribute on the input IR unit. It can also be exposed via CLI options like `--mlir-spirv-target-version`, `--mlir-spirv-allowed-extensions`, `--mlir-spirv-allowed-capabilities` or whatever.

> I ask mainly because we are intending to have a general solution for "target" availability, that should(ideally) be a more general form of some the things introduced here.

That's certainly very useful and long awaited. I'm happy to adopt it when available; also feel free to take whatever useful here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72256/new/

https://reviews.llvm.org/D72256





More information about the llvm-commits mailing list