[Mlir-commits] [mlir] [mlir][spirv] Add mgpu* wrappers for Vulkan runtime, migrate some tests (PR #123114)
Ivan Butygin
llvmlistbot at llvm.org
Wed Jan 15 12:06:42 PST 2025
================
@@ -26,6 +28,36 @@
namespace {
+class VulkanModule;
+
+// Class to be a thing that can be returned from `mgpuModuleGetFunction`.
+struct VulkanFunction {
+ VulkanModule *module;
+ std::string name;
+
+ VulkanFunction(VulkanModule *module, const char *name)
+ : module(module), name(name) {}
+};
+
+// Class to own a copy of the SPIR-V provided to `mgpuModuleLoad` and to manage
+// allocation of pointers returned from `mgpuModuleGetFunction`.
+class VulkanModule {
+public:
+ VulkanModule(const char *ptr, size_t size) : blob(ptr, ptr + size) {}
+ ~VulkanModule() = default;
+
+ VulkanFunction *getFunction(const char *name) {
+ return &functions.emplace_back(this, name);
----------------
Hardcode84 wrote:
vector reallocation on `emplace_back` will invalidate previously obtained pointers.
https://github.com/llvm/llvm-project/pull/123114
More information about the Mlir-commits
mailing list