From 4a90a56a300919f9186537084b49fbb3332fc991 Mon Sep 17 00:00:00 2001 From: JiaoluAMD Date: Mon, 20 Nov 2023 09:42:48 +0800 Subject: [PATCH] Implement new functions from gpurt (#2822) * Implement new functions from gpurt Add AmdTraceRayGetKnownSetRayFlags/AmdTraceRayGetKnownUnsetRayFlags implementations * Add TODO comment --- llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp | 14 ++++++++++++++ llpc/lower/llpcSpirvProcessGpuRtLibrary.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp b/llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp index beab554b23..9ab98a03d1 100644 --- a/llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp +++ b/llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp @@ -104,6 +104,8 @@ SpirvProcessGpuRtLibrary::LibraryFunctionTable::LibraryFunctionTable() { m_libFuncPtrs["AmdTraceRaySetParentId"] = &SpirvProcessGpuRtLibrary::createSetParentId; m_libFuncPtrs["AmdTraceRayDispatchRaysIndex"] = &SpirvProcessGpuRtLibrary::createDispatchRayIndex; m_libFuncPtrs["AmdTraceRayGetStaticId"] = &SpirvProcessGpuRtLibrary::createGetStaticId; + m_libFuncPtrs["AmdTraceRayGetKnownSetRayFlags"] = &SpirvProcessGpuRtLibrary::createGetKnownSetRayFlags; + m_libFuncPtrs["AmdTraceRayGetKnownUnsetRayFlags"] = &SpirvProcessGpuRtLibrary::createGetKnownUnsetRayFlags; } // ===================================================================================================================== @@ -639,4 +641,16 @@ void SpirvProcessGpuRtLibrary::createGetStaticId(llvm::Function *func) { m_builder->CreateRet(m_builder->create()); } +void SpirvProcessGpuRtLibrary::createGetKnownSetRayFlags(llvm::Function *func) { + // TODO: currently return 0 to indicate that there is no known set + // We will probably need to analyse the traceRay ray flags for actual value + m_builder->CreateRet(m_builder->getInt32(0)); +} + +void SpirvProcessGpuRtLibrary::createGetKnownUnsetRayFlags(llvm::Function *func) { + // TODO: return 0 to indicate there is no knownUnset bits + // We will probably need to analyse the traceRay ray flags for actual value + m_builder->CreateRet(m_builder->getInt32(0)); +} + } // namespace Llpc diff --git a/llpc/lower/llpcSpirvProcessGpuRtLibrary.h b/llpc/lower/llpcSpirvProcessGpuRtLibrary.h index df0f5e8014..453d508797 100644 --- a/llpc/lower/llpcSpirvProcessGpuRtLibrary.h +++ b/llpc/lower/llpcSpirvProcessGpuRtLibrary.h @@ -84,6 +84,8 @@ class SpirvProcessGpuRtLibrary : public SpirvLower, public llvm::PassInfoMixin