For example:
```
- %4 = spv.EntryPoint "GLCompute" "foo"
- %3 = spv.EntryPoint "Kernel" "foo", %1, %2 : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
+ spv.EntryPoint "GLCompute" @foo
+ spv.EntryPoint "Kernel" @foo, %1, %2 : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
```
}];
Variadic<SPV_AnyPtr>:$interface
);
- let results = (outs SPV_EntryPoint:$id);
+ let results = (outs);
let autogenSerialization = 0;
}
For example:
```
- spv.ExecutionMode %7 "ContractionOff"
- spv.ExecutionMode %8 "LocalSizeHint", 3, 4, 5
+ spv.ExecutionMode @foo "ContractionOff"
+ spv.ExecutionMode @bar "LocalSizeHint", 3, 4, 5
```
}];
let arguments = (ins
- SPV_EntryPoint:$entry_point,
+ SymbolRefAttr:$fn,
SPV_ExecutionModeAttr:$execution_mode,
OptionalAttr<I32ArrayAttr>:$values
);
let results = (outs);
let verifier = [{ return success(); }];
+
+ let autogenSerialization = 0;
}
// -----
if (!fn.isa<SymbolRefAttr>()) {
return parser->emitError(loc, "expected symbol reference attribute");
}
- state->addTypes(
- spirv::EntryPointType::get(parser->getBuilder().getContext()));
return success();
}
static ParseResult parseExecutionModeOp(OpAsmParser *parser,
OperationState *state) {
- OpAsmParser::OperandType entryPointInfo;
spirv::ExecutionMode execMode;
- if (parser->parseOperand(entryPointInfo) ||
- parser->resolveOperand(entryPointInfo,
- spirv::EntryPointType::get(state->getContext()),
- state->operands) ||
+ Attribute fn;
+ if (parser->parseAttribute(fn, kFnNameAttrName, state->attributes) ||
parseEnumAttribute(execMode, parser, state)) {
return failure();
}
}
static void print(spirv::ExecutionModeOp execModeOp, OpAsmPrinter *printer) {
- *printer << spirv::ExecutionModeOp::getOperationName() << " ";
- printer->printOperand(execModeOp.entry_point());
- *printer << " \"" << stringifyExecutionMode(execModeOp.execution_mode())
- << "\"";
+ *printer << spirv::ExecutionModeOp::getOperationName() << " @"
+ << execModeOp.fn() << " \""
+ << stringifyExecutionMode(execModeOp.execution_mode()) << "\"";
auto values = execModeOp.values();
if (!values) {
return;
func @do_nothing() -> () {
spv.Return
}
- // CHECK: {{%.*}} = spv.EntryPoint "GLCompute" @do_nothing
- %2 = spv.EntryPoint "GLCompute" @do_nothing
+ // CHECK: spv.EntryPoint "GLCompute" @do_nothing
+ spv.EntryPoint "GLCompute" @do_nothing
}
spv.module "Logical" "VulkanKHR" {
spv.Store "Output" %arg1, %1 : f32
spv.Return
}
- // CHECK: {{%.*}} = spv.EntryPoint "GLCompute" @do_something, {{%.*}}, {{%.*}} : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
- %4 = spv.EntryPoint "GLCompute" @do_something, %2, %3 : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
+ // CHECK: spv.EntryPoint "GLCompute" @do_something, {{%.*}}, {{%.*}} : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
+ spv.EntryPoint "GLCompute" @do_something, %2, %3 : !spv.ptr<f32, Input>, !spv.ptr<f32, Output>
}
// -----
spv.Return
}
// expected-error @+1 {{custom op 'spv.EntryPoint' expected symbol reference attribute}}
- %4 = spv.EntryPoint "GLCompute" "do_nothing"
+ spv.EntryPoint "GLCompute" "do_nothing"
}
// -----
spv.Return
}
// expected-error @+1 {{function 'do_something' not found in 'spv.module'}}
- %4 = spv.EntryPoint "GLCompute" @do_something
+ spv.EntryPoint "GLCompute" @do_something
}
/// TODO(ravishankarm) : Add a test that verifies an error is thrown
spv.module "Logical" "VulkanKHR" {
func @do_nothing() -> () {
// expected-error @+1 {{'spv.EntryPoint' op failed to verify that op can only be used in a 'spv.module' block}}
- %2 = spv.EntryPoint "GLCompute" @do_something
+ spv.EntryPoint "GLCompute" @do_something
}
}
func @do_nothing() -> () {
spv.Return
}
- %5 = spv.EntryPoint "GLCompute" @do_nothing
+ spv.EntryPoint "GLCompute" @do_nothing
// expected-error @+1 {{duplicate of a previous EntryPointOp}}
- %6 = spv.EntryPoint "GLCompute" @do_nothing
+ spv.EntryPoint "GLCompute" @do_nothing
}
// -----
func @do_nothing() -> () {
spv.Return
}
- %5 = spv.EntryPoint "GLCompute" @do_nothing
+ spv.EntryPoint "GLCompute" @do_nothing
// expected-error @+1 {{custom op 'spv.EntryPoint' invalid execution_model attribute specification: "ContractionOff"}}
- %6 = spv.EntryPoint "ContractionOff" @do_nothing
+ spv.EntryPoint "ContractionOff" @do_nothing
}
// -----
spv.Return
}
// expected-error @+1 {{'spv.EntryPoint' op invalid storage class 'Workgroup'}}
- %6 = spv.EntryPoint "GLCompute" @do_nothing, %2 : !spv.ptr<f32, Workgroup>
+ spv.EntryPoint "GLCompute" @do_nothing, %2 : !spv.ptr<f32, Workgroup>
}
// -----
func @do_nothing() -> () {
spv.Return
}
- %7 = spv.EntryPoint "GLCompute" @do_nothing
- // CHECK: spv.ExecutionMode {{%.*}} "ContractionOff"
- spv.ExecutionMode %7 "ContractionOff"
+ spv.EntryPoint "GLCompute" @do_nothing
+ // CHECK: spv.ExecutionMode {{@.*}} "ContractionOff"
+ spv.ExecutionMode @do_nothing "ContractionOff"
}
spv.module "Logical" "VulkanKHR" {
func @do_nothing() -> () {
spv.Return
}
- %8 = spv.EntryPoint "GLCompute" @do_nothing
- // CHECK: spv.ExecutionMode {{%.*}} "LocalSizeHint", 3, 4, 5
- spv.ExecutionMode %8 "LocalSizeHint", 3, 4, 5
-}
-
-// -----
-
-spv.module "Logical" "VulkanKHR" {
- // expected-note @+1{{prior use here}}
- %2 = spv.Variable : !spv.ptr<f32, Input>
- func @do_nothing() -> () {
- spv.Return
- }
- %8 = spv.EntryPoint "GLCompute" @do_nothing
- // expected-error @+1 {{use of value '%2' expects different type than prior uses: '!spv.entrypoint' vs '!spv.ptr<f32, Input>'}}
- spv.ExecutionMode %2 "LocalSizeHint", 3, 4, 5
+ spv.EntryPoint "GLCompute" @do_nothing
+ // CHECK: spv.ExecutionMode {{@.*}} "LocalSizeHint", 3, 4, 5
+ spv.ExecutionMode @do_nothing "LocalSizeHint", 3, 4, 5
}
// -----
func @do_nothing() -> () {
spv.Return
}
- %8 = spv.EntryPoint "GLCompute" @do_nothing
+ spv.EntryPoint "GLCompute" @do_nothing
// expected-error @+1 {{custom op 'spv.ExecutionMode' invalid execution_mode attribute specification: "GLCompute"}}
- spv.ExecutionMode %8 "GLCompute", 3, 4, 5
+ spv.ExecutionMode @do_nothing "GLCompute", 3, 4, 5
}
// -----