Current section

Files

Jump to
manx lib manx pass.ex
Raw

lib/manx/pass.ex

defmodule Manx.Lowering.Vulkan.PutSPVAttrPass do
alias Beaver.MLIR
import MLIR.Sigils
alias Beaver.MLIR.Dialect.GPU
use Beaver.MLIR.Pass, on: GPU.Func
def run(op) do
[
"gpu.kernel": Beaver.MLIR.Attribute.unit(),
"spv.entry_point_abi":
~a{#spv.entry_point_abi<local_size = dense<[1, 1, 1]> : vector<3xi32>>}
]
|> Enum.each(fn {name, attr} ->
ctx = MLIR.CAPI.mlirOperationGetContext(op)
attr = Beaver.Deferred.create(attr, ctx)
MLIR.CAPI.mlirOperationSetAttributeByName(op, MLIR.StringRef.create(name), attr)
end)
:ok
end
end