[XLA:CPU] When built with MSAN, unpoison outfed buffers to suppress false-positive MSAN warnings.
PiperOrigin-RevId: 354080879 Change-Id: If5b257d2a0fd992b79806054b43eef4b77f66d72
This commit is contained in:
parent
f898ddfbf5
commit
7d5328c5df
@ -487,6 +487,17 @@ Status IrEmitter::EmitXfeedTransfer(XfeedKind kind, const Shape& shape,
|
|||||||
MemCpy(acquired_pointer, /*DstAlign=*/llvm::Align(1),
|
MemCpy(acquired_pointer, /*DstAlign=*/llvm::Align(1),
|
||||||
program_buffer_address,
|
program_buffer_address,
|
||||||
/*SrcAlign=*/llvm::Align(1), length_32);
|
/*SrcAlign=*/llvm::Align(1), length_32);
|
||||||
|
if (emit_code_for_msan_) {
|
||||||
|
// Mark the outfed data as initialized for msan. The buffer gets read by
|
||||||
|
// the host code, which might be msan-instrumented.
|
||||||
|
// TODO(b/66051036): Run the msan instrumentation pass instead.
|
||||||
|
const llvm::DataLayout& dl = module_->getDataLayout();
|
||||||
|
llvm::Type* intptr_type = b_.getIntPtrTy(dl);
|
||||||
|
EmitCallToFunc(
|
||||||
|
"__msan_unpoison",
|
||||||
|
{acquired_pointer, llvm::ConstantInt::get(intptr_type, length)},
|
||||||
|
b_.getVoidTy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* release_func_name =
|
const char* release_func_name =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user