From ff03a7b193dae5ccdd0166199727f1a68657ffdd Mon Sep 17 00:00:00 2001 From: Austin Annestrand Date: Tue, 19 Mar 2024 10:54:22 -0500 Subject: [PATCH] CL/VK: Program build_status & mCallback fixes Was missing saving the build_status in the program export/binary to disk. Also, missing dereference for mCallback. Bug: angleproject:8435 Change-Id: I77f070f5bc1c40454d625abcf13c1a4b70c465b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5406613 Reviewed-by: Shahbaz Youssefi Commit-Queue: Austin Annestrand Reviewed-by: Geoff Lang --- src/libANGLE/CLProgram.cpp | 4 ++-- src/libANGLE/renderer/vulkan/CLProgramVk.cpp | 10 ++++++---- src/libANGLE/renderer/vulkan/CLProgramVk.h | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libANGLE/CLProgram.cpp b/src/libANGLE/CLProgram.cpp index 4ca722eabe4..e3db897f729 100644 --- a/src/libANGLE/CLProgram.cpp +++ b/src/libANGLE/CLProgram.cpp @@ -257,11 +257,11 @@ Program::Program(Context &context, { // This program has to be retained until the notify callback is called. retain(); - mCallback = CallbackData(pfnNotify, userData); + *mCallback = CallbackData(pfnNotify, userData); } else { - mCallback = CallbackData(); + *mCallback = CallbackData(); } ANGLE_CL_IMPL_TRY(context.getImpl().linkProgram(*this, mDevices, options, inputPrograms, pfnNotify != nullptr ? this : nullptr, &mImpl)); diff --git a/src/libANGLE/renderer/vulkan/CLProgramVk.cpp b/src/libANGLE/renderer/vulkan/CLProgramVk.cpp index 388fd93054d..b0e53d9fe5f 100644 --- a/src/libANGLE/renderer/vulkan/CLProgramVk.cpp +++ b/src/libANGLE/renderer/vulkan/CLProgramVk.cpp @@ -299,7 +299,7 @@ angle::Result CLProgramVk::init(const size_t *lengths, } ANGLE_CL_RETURN_ERROR(CL_INVALID_BINARY); } - else if (binaryHeader->headerVersion < LatestSupportedBinaryVersion) + else if (binaryHeader->headerVersion < kBinaryVersion) { ERR() << "Binary version not compatible with runtime!"; if (binaryStatus) @@ -330,7 +330,8 @@ angle::Result CLProgramVk::init(const size_t *lengths, // Add device binary to program DeviceProgramData deviceBinary; - deviceBinary.binaryType = binaryHeader->binaryType; + deviceBinary.binaryType = binaryHeader->binaryType; + deviceBinary.buildStatus = binaryHeader->buildStatus; switch (deviceBinary.binaryType) { case CL_PROGRAM_BINARY_TYPE_EXECUTABLE: @@ -512,8 +513,9 @@ angle::Result CLProgramVk::getInfo(cl::ProgramInfo name, deviceProgram.second.binaryType == CL_PROGRAM_BINARY_TYPE_EXECUTABLE ? deviceProgram.second.binary.size() * sizeof(uint32_t) : deviceProgram.second.IR.size(); - ProgramBinaryOutputHeader header{.headerVersion = LatestSupportedBinaryVersion, - .binaryType = deviceProgram.second.binaryType}; + ProgramBinaryOutputHeader header{.headerVersion = kBinaryVersion, + .binaryType = deviceProgram.second.binaryType, + .buildStatus = deviceProgram.second.buildStatus}; if (outputBins != nullptr) { diff --git a/src/libANGLE/renderer/vulkan/CLProgramVk.h b/src/libANGLE/renderer/vulkan/CLProgramVk.h index da85bab902f..d67ba72227b 100644 --- a/src/libANGLE/renderer/vulkan/CLProgramVk.h +++ b/src/libANGLE/renderer/vulkan/CLProgramVk.h @@ -45,12 +45,13 @@ class CLProgramVk : public CLProgramImpl }; // Output binary structure (for CL_PROGRAM_BINARIES query) + static constexpr uint32_t kBinaryVersion = 2; struct ProgramBinaryOutputHeader { - uint32_t headerVersion{1}; + uint32_t headerVersion{kBinaryVersion}; cl_program_binary_type binaryType{CL_PROGRAM_BINARY_TYPE_NONE}; + cl_build_status buildStatus{CL_BUILD_NONE}; }; - static constexpr uint32_t LatestSupportedBinaryVersion = 1; struct ScopedClspvContext : angle::NonCopyable {