Skip to content

Commit b65d187

Browse files
committed
More CHECK_ERR cleanup
1 parent 7dfdd6f commit b65d187

File tree

6 files changed

+9
-18
lines changed

6 files changed

+9
-18
lines changed

algorithms/Common.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,9 @@ int blockcount(F&& func, int blocksize) {
6161
int smCount = 0;
6262
int blocksPerSM = 0;
6363
APIWRAP(cudaGetDevice(&device));
64-
CHECK_ERR;
6564
APIWRAP(cudaDeviceGetAttribute(&smCount, cudaDevAttrMultiProcessorCount, device));
66-
CHECK_ERR;
6765
APIWRAP(cudaOccupancyMaxActiveBlocksPerMultiprocessor(
6866
&blocksPerSM, std::forward<F>(func), blocksize, 0));
69-
CHECK_ERR;
7067
return smCount * blocksPerSM;
7168
}
7269

@@ -90,12 +87,9 @@ int blockcount(F&& func, int blocksize) {
9087
int smCount = 0;
9188
int blocksPerSM = 0;
9289
APIWRAP(hipGetDevice(&device));
93-
CHECK_ERR;
9490
APIWRAP(hipDeviceGetAttribute(&smCount, hipDeviceAttributeMultiprocessorCount, device));
95-
CHECK_ERR;
9691
APIWRAP(hipOccupancyMaxActiveBlocksPerMultiprocessor(
9792
&blocksPerSM, std::forward<F>(func), blocksize, 0));
98-
CHECK_ERR;
9993
return smCount * blocksPerSM;
10094
}
10195

interfaces/cuda/Events.cu

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ void* ConcreteAPI::createEvent(bool withTiming) {
2020
} else {
2121
APIWRAP(cudaEventCreateWithFlags(&event, cudaEventDisableTiming));
2222
}
23-
CHECK_ERR;
2423
return static_cast<void*>(event);
2524
}
2625

@@ -35,31 +34,29 @@ double ConcreteAPI::timespanEvents(void* eventPtrStart, void* eventPtrEnd) {
3534
void ConcreteAPI::destroyEvent(void* eventPtr) {
3635
cudaEvent_t event = static_cast<cudaEvent_t>(eventPtr);
3736
APIWRAP(cudaEventDestroy(event));
38-
CHECK_ERR;
3937
}
4038

4139
void ConcreteAPI::syncEventWithHost(void* eventPtr) {
4240
cudaEvent_t event = static_cast<cudaEvent_t>(eventPtr);
43-
APIWRAP(cudaEventSynchronize(event));
41+
4442
CHECK_ERR;
43+
44+
APIWRAP(cudaEventSynchronize(event));
4545
}
4646

4747
bool ConcreteAPI::isEventCompleted(void* eventPtr) {
4848
cudaEvent_t event = static_cast<cudaEvent_t>(eventPtr);
4949
auto result = APIWRAPX(cudaEventQuery(event), {cudaErrorNotReady});
50-
CHECK_ERR;
5150
return result == cudaSuccess;
5251
}
5352

5453
void ConcreteAPI::recordEventOnHost(void* eventPtr) {
5554
cudaEvent_t event = static_cast<cudaEvent_t>(eventPtr);
5655
APIWRAP(cudaEventRecord(event));
57-
CHECK_ERR;
5856
}
5957

6058
void ConcreteAPI::recordEventOnStream(void* eventPtr, void* streamPtr) {
6159
cudaEvent_t event = static_cast<cudaEvent_t>(eventPtr);
6260
cudaStream_t stream = static_cast<cudaStream_t>(streamPtr);
6361
APIWRAP(cudaEventRecord(event, stream));
64-
CHECK_ERR;
6562
}

interfaces/cuda/Memory.cu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ void* ConcreteAPI::allocGlobMem(size_t size, bool compress) {
7979
allocationProperties[devPtr] = reinterpret_cast<void*>(new CUmemAllocationProp(prop));
8080
} else {
8181
APIWRAP(cudaMalloc(&devPtr, size));
82-
CHECK_ERR;
8382
}
8483
statistics.allocatedMemBytes += size;
8584
memToSizeMap[devPtr] = size;
@@ -90,7 +89,6 @@ void* ConcreteAPI::allocUnifiedMem(size_t size, bool compress, Destination hint)
9089
isFlagSet<DeviceSelected>(status);
9190
void* devPtr = nullptr;
9291
APIWRAP(cudaMallocManaged(&devPtr, size, cudaMemAttachGlobal));
93-
CHECK_ERR;
9492

9593
cudaMemLocation location{};
9694
if (hint == Destination::Host) {
@@ -114,7 +112,6 @@ void* ConcreteAPI::allocUnifiedMem(size_t size, bool compress, Destination hint)
114112
location.id
115113
#endif
116114
));
117-
CHECK_ERR;
118115

119116
statistics.allocatedMemBytes += size;
120117
statistics.allocatedUnifiedMemBytes += size;
@@ -127,7 +124,6 @@ void* ConcreteAPI::allocPinnedMem(size_t size, bool compress, Destination hint)
127124
void* devPtr = nullptr;
128125
const auto flag = hint == Destination::Host ? cudaHostAllocDefault : cudaHostAllocMapped;
129126
APIWRAP(cudaHostAlloc(&devPtr, size, flag));
130-
CHECK_ERR;
131127
statistics.allocatedMemBytes += size;
132128
memToSizeMap[devPtr] = size;
133129
return devPtr;

interfaces/cuda/Streams.cu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ bool ConcreteAPI::isStreamWorkDone(void* streamPtr) {
5858
isFlagSet<InterfaceInitialized>(status);
5959
cudaStream_t stream = static_cast<cudaStream_t>(streamPtr);
6060

61-
CHECK_ERR;
62-
6361
const auto streamStatus = APIWRAPX(cudaStreamQuery(stream), {cudaErrorNotReady});
6462

6563
return streamStatus == cudaSuccess;

interfaces/hip/Events.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ void ConcreteAPI::destroyEvent(void* eventPtr) {
3939

4040
void ConcreteAPI::syncEventWithHost(void* eventPtr) {
4141
hipEvent_t event = static_cast<hipEvent_t>(eventPtr);
42+
43+
CHECK_ERR;
44+
4245
APIWRAP(hipEventSynchronize(event));
4346
}
4447

interfaces/hip/Streams.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ void ConcreteAPI::destroyGenericStream(void* streamPtr) {
4747
void ConcreteAPI::syncStreamWithHost(void* streamPtr) {
4848
isFlagSet<InterfaceInitialized>(status);
4949
hipStream_t stream = static_cast<hipStream_t>(streamPtr);
50+
51+
CHECK_ERR;
52+
5053
APIWRAP(hipStreamSynchronize(stream));
5154
}
5255

0 commit comments

Comments
 (0)