Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.4 #39

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HIP RT SDK

**This repository is only for tutorials. The SDK binaries needs to be downloaded from [HIP RT project page](https://gpuopen.com/hiprt/).**
**This repository is only for tutorials. The SDK binaries needs to be downloaded from [HIP RT project page](https://gpuopen.com/hiprt/) and the full source code of HIP RT can be found [here](https://github.com/GPUOpen-LibrariesAndSDKs/HIPRT).**

HIP RT is a ray tracing library in HIP. The APIs are designed to be minimal and low level, making it easy to write a ray tracing application in HIP. We designed the library and APIs to be simple to use and integrate into any existing HIP applications. Although there are a few other ray tracing APIs which, we designed HIP RT to be simpler and easier to use, so you do not need to learn many new kernel types.

Expand Down Expand Up @@ -53,7 +53,7 @@ Windows:
3. Run premake to generate a solution for Visual Studio 2022:
````
cd tutorials
../tools/premake5/win/premake5.exe vs2022
"../tools/premake5/win/premake5.exe" vs2022
````

4. Open the solution, compile & run.
Expand Down
2 changes: 1 addition & 1 deletion contrib/Orochi
Submodule Orochi updated 129 files
8 changes: 4 additions & 4 deletions tutorials/03_custom_intersection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class Tutorial : public TutorialBase
std::vector<hiprtFuncNameSet> funcNameSets = { funcNameSet };

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO(
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), SphereCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), spheres, SphereCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -100,7 +100,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "03_custom_intersection.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );
Expand Down
20 changes: 8 additions & 12 deletions tutorials/11_multi_custom_intersection/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,14 @@ class Tutorial : public TutorialBase
1 );

std::vector<hiprtFuncDataSet> funcDataSets( GeomTypesCount );
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
CHECK_ORO(
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSets[SphereTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ),
&sphere,
sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ), &sphere, sizeof( hiprtFloat4 ) ) );
CHECK_ORO(
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSets[CircleTypeIndex].intersectFuncData ), sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ),
&circle,
sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ), &circle, sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, GeomTypesCount, 1, funcTable ) );
Expand All @@ -190,8 +186,8 @@ class Tutorial : public TutorialBase
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( listCircles.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[SphereTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSets[CircleTypeIndex].intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pixels ) ) );

CHECK_HIPRT( hiprtDestroyGeometry( ctxt, geomSpheres ) );
Expand Down
8 changes: 4 additions & 4 deletions tutorials/13_concurrent_scene_build/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ class Tutorial : public TutorialBase
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO(
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -203,7 +203,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "13_concurrent_scene_build.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );
Expand Down
7 changes: 3 additions & 4 deletions tutorials/14_batch_build/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,9 @@ class Tutorial : public TutorialBase
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMalloc( const_cast<void**>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -189,7 +188,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "14_batch_build.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInput.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( mesh.triangleIndices ) ) );
Expand Down
8 changes: 4 additions & 4 deletions tutorials/15_multi_level_instancing/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ class Tutorial : public TutorialBase
ctxt, "../common/TutorialKernels.h", "SceneBuildKernel", func, nullptr, &funcNameSets, 1, 1 );

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO(
oroMalloc( const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), CircleCount * sizeof( hiprtFloat4 ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ), circles, CircleCount * sizeof( hiprtFloat4 ) ) );

hiprtFuncTable funcTable;
CHECK_HIPRT( hiprtCreateFuncTable( ctxt, 1, 1, funcTable ) );
Expand All @@ -239,7 +239,7 @@ class Tutorial : public TutorialBase
launchKernel( func, m_res.x, m_res.y, args );
writeImage( "15_multi_level_instancing.png", m_res.x, m_res.y, pixels );

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instances ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputTop.instanceFrames ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( sceneInputMid.instances ) ) );
Expand Down
6 changes: 3 additions & 3 deletions tutorials/16_fluid_simulation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ class Tutorial : public TutorialBase

hiprtFuncDataSet funcDataSet;
CHECK_ORO( oroMalloc(
reinterpret_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
const_cast<oroDeviceptr*>( &funcDataSet.intersectFuncData ), sim.m_particleCount * sizeof( Particle ) ) );
CHECK_ORO( oroMemcpyHtoD(
reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ),
particles.data(),
sim.m_particleCount * sizeof( Particle ) ) );

Expand Down Expand Up @@ -230,7 +230,7 @@ class Tutorial : public TutorialBase
}
}

CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( const_cast<oroDeviceptr>( funcDataSet.intersectFuncData ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( list.aabbs ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( geomTemp ) ) );
CHECK_ORO( oroFree( reinterpret_cast<oroDeviceptr>( pSim ) ) );
Expand Down
2 changes: 1 addition & 1 deletion tutorials/17_hiprt_hip/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ project "17_hiprt_hip"
files { "./**.h", "./**.cpp"}
files { "../../hiprt/*.h"}

links {"hiprt0200264"}
links {"hiprt0200464"}
targetdir "../dist/bin/%{cfg.buildcfg}"
5 changes: 4 additions & 1 deletion tutorials/common/TutorialBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <tutorials/common/TutorialBase.h>

#include <hiprt/hiprt_libpath.h>

#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <contrib/stbi/stbi_image_write.h>

Expand Down Expand Up @@ -61,7 +63,8 @@ void TutorialBase::init( uint32_t deviceIndex )
{
m_res = make_hiprtInt2( 512, 512 );

CHECK_ORO( static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0 ) ) );
CHECK_ORO(
static_cast<oroError>( oroInitialize( (oroApi)( ORO_API_HIP | ORO_API_CUDA ), 0, g_hip_paths, g_hiprtc_paths ) ) );

CHECK_ORO( oroInit( 0 ) );
CHECK_ORO( oroDeviceGet( &m_oroDevice, deviceIndex ) );
Expand Down
2 changes: 1 addition & 1 deletion tutorials/common/dependency.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ if os.ishost("linux") then
end

files { "../../hiprt/*.h"}
links {"hiprt0200264"}
links {"hiprt0200464"}