Enzyme main
Loading...
Searching...
No Matches
LLVMExtOps.cpp
Go to the documentation of this file.
2
3namespace mlir {
4namespace enzyme {} // namespace enzyme
5} // namespace mlir
6
7#define GET_OP_CLASSES
8#include "Dialect/LLVMExt/LLVMExtOps.cpp.inc"
9
10using namespace mlir;
11using namespace mlir::enzyme;
12
13// A copy is lowered as one operation in one memory space -- a host memcpy or a
14// device-to-device runtime copy -- so a mismatch here is a transfer nothing
15// downstream can express, not something to silently pick a side of.
16LogicalResult llvm_ext::MemcpyOp::verify() {
17 auto dstSpace =
18 cast<LLVM::LLVMPointerType>(getDst().getType()).getAddressSpace();
19 auto srcSpace =
20 cast<LLVM::LLVMPointerType>(getSrc().getType()).getAddressSpace();
21 if (dstSpace != srcSpace)
22 return emitOpError() << "destination is in memory space " << dstSpace
23 << " but source is in memory space " << srcSpace
24 << "; a copy across memory spaces is not supported";
25 return success();
26}