Skip to content

Commit

Permalink
REMOVE_ME: add more debug printing
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Sep 16, 2024
1 parent 8376161 commit a28604f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/bvh/split/cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ namespace bvh
// Mark these with 1, then we can execute an exclusive scan to re-index
Kokkos::parallel_for( n - 1, KOKKOS_CLASS_LAMBDA( std::size_t _i ) {
m_reindex( m_depths_indices( _i ) ) = ( _i < cluster_count ) ? 1 : 0;
printf( "cluster_count: %d\t_i: %d\t m_depths_indices(_i): %d\tm_reindex(...): %d\n",
static_cast< int >( cluster_count ), static_cast< int >( _i ),
static_cast< int >( m_depths_indices( _i ) ), static_cast< int >( m_reindex( m_depths_indices( _i ) ) ) );
} );

prefix_sum( m_reindex );
Expand Down
13 changes: 12 additions & 1 deletion src/bvh/util/sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#ifndef INC_BVH_UTIL_SORT_HPP
#define INC_BVH_UTIL_SORT_HPP

#include <Kokkos_Core.hpp>
#include <cstdint>
#include <cstdlib>

Expand Down Expand Up @@ -122,16 +123,26 @@ namespace bvh
m_bits( i ) = ~h & 0x1;
m_scan( i ) = m_bits( i );
} );
// Kokkos::fence();

prefix_sum( m_scan );
Kokkos::parallel_for( n, KOKKOS_CLASS_LAMBDA ( int i ){
// Kokkos::fence();

Kokkos::parallel_for( n, KOKKOS_CLASS_LAMBDA( int i ) {
// this seems to work fine
// printf("i: %d\t num_bits: %d\t _shift: %d\t \n",
// i,
// static_cast<int>(num_bits),
// static_cast<int>(_shift));

const auto total = m_scan( n - 1 ) + m_bits( n - 1 );

auto t = i - m_scan( i ) + total;
auto new_idx = m_bits( i ) ? m_scan( i ) : t;
m_index_scratch( new_idx ) = _indices( i );
m_scratch( new_idx ) = _hashes( i );
} );
// Kokkos::fence();
}

private:
Expand Down

0 comments on commit a28604f

Please sign in to comment.