From 454dc540f244038d5bb877be03af093f445cd133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABlle=20van=20Essen?= Date: Thu, 6 Feb 2025 11:32:45 +0100 Subject: [PATCH] LLVM unit tests: fix - parse bitcode in context --- ptx/src/pass/emit_llvm.rs | 5 +++-- ptx/src/test/spirv_run/mod.rs | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs index af5d905..fe303ca 100644 --- a/ptx/src/pass/emit_llvm.rs +++ b/ptx/src/pass/emit_llvm.rs @@ -33,7 +33,7 @@ use std::{i8, ptr}; use super::*; use llvm_zluda::analysis::{LLVMVerifierFailureAction, LLVMVerifyModule}; -use llvm_zluda::bit_reader::LLVMParseBitcode2; +use llvm_zluda::bit_reader::LLVMParseBitcodeInContext2; use llvm_zluda::bit_writer::LLVMWriteBitcodeToMemoryBuffer; use llvm_zluda::{core::*, *}; use llvm_zluda::{prelude::*, LLVMZludaBuildAtomicRMW}; @@ -158,7 +158,8 @@ impl MemoryBuffer { if p_module.is_null() { handle_alloc_error(layout); } - LLVMParseBitcode2(self.0, p_module as *mut LLVMModuleRef); + let context = Context::new(); + LLVMParseBitcodeInContext2(context.0, self.0, p_module as *mut LLVMModuleRef); let asm = LLVMPrintModuleToString(*(p_module as *mut LLVMModuleRef)); LLVMDisposeModule(*(p_module as *mut LLVMModuleRef)); dealloc(p_module, layout); diff --git a/ptx/src/test/spirv_run/mod.rs b/ptx/src/test/spirv_run/mod.rs index aca0909..2ca6ad4 100644 --- a/ptx/src/test/spirv_run/mod.rs +++ b/ptx/src/test/spirv_run/mod.rs @@ -33,7 +33,6 @@ macro_rules! test_ptx { #[test] fn [<$fn_name _llvm>]() -> Result<(), Box> { let fn_name = stringify!($fn_name); - println!("{}", fn_name); let ptx = include_str!(concat!(stringify!($fn_name), ".ptx")); let ll = include_str!(concat!("../ll/", stringify!($fn_name), ".ll")).trim(); test_llvm_assert(ptx, &ll)