[llvm] [offload] Verify replay config of teams/threads is allowed (PR #192784)
Konstantinos Parasyris via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 14:00:59 PDT 2026
================
@@ -167,81 +271,89 @@ int main(int argc, char **argv) {
Desc.HostEntriesEnd = &OffloadEntries[OffloadEntries.size() - 1] + 1;
Desc.DeviceImages = &DeviceImage;
- auto DeviceIdJson = JsonKernelInfo->getAsObject()->getInteger("DeviceId");
- // TODO: Print warning if the user overrides the device id in the json file.
- int32_t DeviceId = (DeviceIdOpt > -1 ? DeviceIdOpt : DeviceIdJson.value());
-
- // TODO: do we need requires?
- //__tgt_register_requires(/*Flags=*/1);
-
+ // Register the image and the offload entries.
__tgt_register_lib(&Desc);
int Rc = __tgt_activate_record_replay(
- DeviceId, VAllocSize, VAllocAddr, /*IsRecord=*/false, VerifyOpt,
+ DeviceId, VAllocSize, VAllocAddr, /*IsRecord=*/false,
+ VerifyOpt || SaveOutputOpt,
/*EmitReport=*/false, Directory.c_str());
if (Rc != OMP_TGT_SUCCESS)
- reportFatalUsageError("Error activating record replay");
+ return createErr("failed to activate record replay");
+ // Load the record input file.
Filepath.replace_extension("record_input");
- ErrorOr<std::unique_ptr<MemoryBuffer>> DeviceMemoryMB =
+ auto RecordInputBufferOrErr =
MemoryBuffer::getFile(Filepath.string(), /*isText=*/false,
/*RequiresNullTerminator=*/false);
-
- if (!DeviceMemoryMB)
- reportFatalUsageError("Error reading the kernel record input file");
+ if (!RecordInputBufferOrErr)
+ return createErr("failed to read the kernel record input file");
+ auto RecordInputBuffer = std::move(RecordInputBufferOrErr.get());
// On AMD for currently unknown reasons we cannot copy memory mapped data to
// device. This is a work-around.
- uint8_t *RecordedData = new uint8_t[DeviceMemoryMB.get()->getBufferSize()];
+ uint8_t *RecordedData = new uint8_t[RecordInputBuffer->getBufferSize()];
----------------
koparasy wrote:
Is the above comment I had still true?
https://github.com/llvm/llvm-project/pull/192784
More information about the llvm-commits
mailing list