Bug 5812203: Replace thrust::make_tuple,tuple,get with the cuda::std ones

This commit is contained in:
Shawn Zeng
2026-01-16 17:56:50 +08:00
parent af49216f0c
commit 6c4d183ba3
6 changed files with 43 additions and 38 deletions

View File

@@ -135,8 +135,8 @@ extern "C"
thrust::device_ptr<float4> d_pos4((float4 *)pos);
thrust::device_ptr<float4> d_vel4((float4 *)vel);
thrust::for_each(thrust::make_zip_iterator(thrust::make_tuple(d_pos4, d_vel4)),
thrust::make_zip_iterator(thrust::make_tuple(d_pos4 + numParticles, d_vel4 + numParticles)),
thrust::for_each(thrust::make_zip_iterator(d_pos4, d_vel4),
thrust::make_zip_iterator(d_pos4 + numParticles, d_vel4 + numParticles),
integrate_functor(deltaTime));
}

View File

@@ -41,6 +41,9 @@
#include "thrust/iterator/zip_iterator.h"
#include "thrust/sort.h"
// for cuda::std::get
#include <cuda/std/utility>
namespace cg = cooperative_groups;
#include "helper_math.h"
#include "math_constants.h"
@@ -60,8 +63,8 @@ struct integrate_functor
template <typename Tuple> __device__ void operator()(Tuple t)
{
volatile float4 posData = thrust::get<0>(t);
volatile float4 velData = thrust::get<1>(t);
volatile float4 posData = cuda::std::get<0>(t);
volatile float4 velData = cuda::std::get<1>(t);
float3 pos = make_float3(posData.x, posData.y, posData.z);
float3 vel = make_float3(velData.x, velData.y, velData.z);
@@ -107,8 +110,8 @@ struct integrate_functor
}
// store new position and velocity
thrust::get<0>(t) = make_float4(pos, posData.w);
thrust::get<1>(t) = make_float4(vel, velData.w);
cuda::std::get<0>(t) = make_float4(pos, posData.w);
cuda::std::get<1>(t) = make_float4(vel, velData.w);
}
};

View File

@@ -505,13 +505,12 @@ private:
thrust::device_ptr<uint> dMinScannedEdges = pools.uintEdges.get();
thrust::device_ptr<float> dMinScannedWeights = pools.floatEdges.get();
thrust::inclusive_scan_by_key(
dEdgesFlags,
dEdgesFlags + edgesCount_,
thrust::make_zip_iterator(thrust::make_tuple(dWeights_, dEdges_)),
thrust::make_zip_iterator(thrust::make_tuple(dMinScannedWeights, dMinScannedEdges)),
thrust::greater_equal<uint>(),
thrust::minimum<thrust::tuple<float, uint>>());
thrust::inclusive_scan_by_key(dEdgesFlags,
dEdgesFlags + edgesCount_,
thrust::make_zip_iterator(dWeights_, dEdges_),
thrust::make_zip_iterator(dMinScannedWeights, dMinScannedEdges),
thrust::greater_equal<uint>(),
thrust::minimum<cuda::std::tuple<float, uint>>());
// To make things clear.
// Let "dEdgesFlags" denote groups of edges that
@@ -562,11 +561,10 @@ private:
thrust::sequence(dClusteredVerticesIDs, dClusteredVerticesIDs + verticesCount_);
thrust::sort(thrust::make_zip_iterator(thrust::make_tuple(thrust::device_ptr<uint>(dSuccessors),
thrust::device_ptr<uint>(dClusteredVerticesIDs))),
thrust::make_zip_iterator(
thrust::make_tuple(thrust::device_ptr<uint>(dSuccessors + verticesCount_),
thrust::device_ptr<uint>(dClusteredVerticesIDs + verticesCount_))));
thrust::sort(thrust::make_zip_iterator(thrust::device_ptr<uint>(dSuccessors),
thrust::device_ptr<uint>(dClusteredVerticesIDs)),
thrust::make_zip_iterator(thrust::device_ptr<uint>(dSuccessors + verticesCount_),
thrust::device_ptr<uint>(dClusteredVerticesIDs + verticesCount_)));
// Mark those groups.
thrust::device_ptr<uint> dVerticesFlags_ = pools.uintVertices.get();
@@ -653,9 +651,8 @@ private:
// the step of the algorithm to that one. Hence we need to
// preserve the structure of the original graph: neighbours and
// weights should be grouped by vertex.
thrust::sort(thrust::make_zip_iterator(thrust::make_tuple(dNewStartpoints, dSurvivedEdgesIDs)),
thrust::make_zip_iterator(
thrust::make_tuple(dNewStartpoints + edgesCount_, dSurvivedEdgesIDs + edgesCount_)));
thrust::sort(thrust::make_zip_iterator(dNewStartpoints, dSurvivedEdgesIDs),
thrust::make_zip_iterator(dNewStartpoints + edgesCount_, dSurvivedEdgesIDs + edgesCount_));
// Find the group of contracted edges.
uint *invalidEdgesPtr =