From 03005140dde6c45a47d1fe03a183d76af38b7a12 Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Wed, 23 Sep 2020 00:40:26 +0200 Subject: [PATCH] Add a workaround for IGC bug --- ptx/src/translate.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs index 22e16ff..5b03f0b 100644 --- a/ptx/src/translate.rs +++ b/ptx/src/translate.rs @@ -299,7 +299,6 @@ fn emit_function_header<'a>( pub fn to_spirv<'a>(ast: ast::Module<'a>) -> Result, TranslateError> { let module = to_spirv_module(ast)?; - eprintln!("{}", module.disassemble()); Ok(module.assemble()) } @@ -1305,7 +1304,18 @@ fn emit_function_body_ops( let result_id = Some(a.dst); let operand = a.src; match t { - ast::NotType::Pred => builder.logical_not(result_type, result_id, operand), + ast::NotType::Pred => { + // HACK ALERT + // Temporary workaround until IGC gets its shit together + // Currently IGC carries two copies of SPIRV-LLVM translator + // a new one in /llvm-spirv/ and old one in /IGC/AdaptorOCL/SPIRV/. + // Obviously, old and buggy one is used for compiling L0 SPIRV + // https://github.com/intel/intel-graphics-compiler/issues/148 + let type_pred = map.get_or_add_scalar(builder, ast::ScalarType::Pred); + let const_true = builder.constant_true(type_pred); + let const_false = builder.constant_false(type_pred); + builder.select(result_type, result_id, operand, const_false, const_true) + }, _ => builder.not(result_type, result_id, operand), }?; }