MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / SafeAdd2D

Function SafeAdd2D

oneflow/user/kernels/grid_sample_kernel_util.h:296–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294
295template<typename scalar_t, typename index_t>
296static OF_DEVICE_FUNC void SafeAdd2D(scalar_t* data, int h, int w, int sH, int sW, int H, int W,
297 scalar_t delta, const index_t NC_offset,
298 const index_t memory_span) {
299 if (WithinBounds2D(h, w, H, W)) {
300#if defined(__CUDACC__)
301 cuda::atomic::Add(data + NC_offset + h * sH + w * sW, delta);
302#else
303 data[NC_offset + h * sH + w * sW] += delta;
304#endif
305 }
306}
307
308template<typename scalar_t, typename index_t>
309static OF_DEVICE_FUNC void SafeAdd3D(scalar_t* data, int d, int h, int w, int sD, int sH, int sW,

Callers 2

AddValueBoundedFunction · 0.85
XPU_1D_KERNEL_LOOPFunction · 0.85

Calls 2

WithinBounds2DFunction · 0.85
AddClass · 0.85

Tested by

no test coverage detected