Skip to content

Commit

Permalink
Implement new functions from gpurt (GPUOpen-Drivers#2822)
Browse files Browse the repository at this point in the history
* Implement new functions from gpurt

Add AmdTraceRayGetKnownSetRayFlags/AmdTraceRayGetKnownUnsetRayFlags
implementations

* Add TODO comment
  • Loading branch information
jiaolu authored Nov 20, 2023
1 parent abfdaf5 commit 4a90a56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llpc/lower/llpcSpirvProcessGpuRtLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

// =====================================================================================================================
Expand Down Expand Up @@ -639,4 +641,16 @@ void SpirvProcessGpuRtLibrary::createGetStaticId(llvm::Function *func) {
m_builder->CreateRet(m_builder->create<GpurtGetRayStaticIdOp>());
}

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
2 changes: 2 additions & 0 deletions llpc/lower/llpcSpirvProcessGpuRtLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class SpirvProcessGpuRtLibrary : public SpirvLower, public llvm::PassInfoMixin<S
void createSetParentId(llvm::Function *func);
void createDispatchRayIndex(llvm::Function *func);
void createGetStaticId(llvm::Function *func);
void createGetKnownSetRayFlags(llvm::Function *func);
void createGetKnownUnsetRayFlags(llvm::Function *func);
llvm::Value *createGetBvhSrd(llvm::Value *expansion, llvm::Value *boxSortMode);
};
} // namespace Llpc

0 comments on commit 4a90a56

Please sign in to comment.