Skip to content

Commit 87d718d

Browse files
committed
Fixed leak
1 parent 7cbd152 commit 87d718d

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,11 +2811,6 @@ pi_result cuda_piextEventCreateWithNativeHandle(pi_native_handle nativeHandle,
28112811
return {};
28122812
}
28132813

2814-
_pi_sampler::_pi_sampler(pi_context context) {
2815-
context_ = context;
2816-
props_ = 0;
2817-
}
2818-
28192814
/// Creates a PI sampler object
28202815
///
28212816
/// \param[in] context The context the sampler is created for.
@@ -2940,7 +2935,7 @@ pi_result cuda_piSamplerRelease(pi_sampler sampler) {
29402935
// double delete or someone is messing with the ref count.
29412936
// either way, cannot safely proceed.
29422937
cl::sycl::detail::pi::assertion(
2943-
sampler->get_reference_count() > 0,
2938+
sampler->get_reference_count() != 0,
29442939
"Reference count overflow detected in cuda_piSamplerRelease.");
29452940

29462941
// decrement ref count. If it is 0, delete the sampler.

sycl/plugins/cuda/pi_cuda.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,8 @@ struct _pi_sampler {
581581
pi_uint32 props_;
582582
pi_context context_;
583583

584-
_pi_sampler(pi_context context);
584+
_pi_sampler(pi_context context)
585+
: refCount_(1), props_(0), context_(context) {}
585586

586587
pi_uint32 increment_reference_count() noexcept { return ++refCount_; }
587588

0 commit comments

Comments
 (0)