Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pushpull.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,7 +136,7 @@ void push(
{
offset_t numel_batch = prod(size_grid, nbatch); // parallel batch loop
offset_t numel_spatial = prod<ndim>(size_grid+nbatch); // sequential spatial loop (no channel)
long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand DownExpand Up@@ -210,7 +210,7 @@ void count(
{
offset_t numel_batch = prod(size_grid, nbatch);
offset_t numel_spatial = prod<ndim>(size_grid+nbatch);
long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand DownExpand Up@@ -428,7 +428,7 @@ void pull_backward(
{
offset_t numel_batch = prod(size_grid, nbatch);
offset_t numel_spatial = prod<ndim>(size_grid+nbatch);
long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand DownExpand Up@@ -696,7 +696,7 @@ void grad_backward(
auto get_ginp_offset = [&](offset_t j) {
return index2offset<ndim>(j, size_grid+nbatch, stride_ginp+nbatch); };

long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand Down
4 changes: 2 additions & 2 deletions restrict.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -98,7 +98,7 @@ void loop(
{
offset_t numel_batch = prod(fullsize, nbatch);
offset_t numel_spatial = prod<ndim>(fullsize+nbatch);
long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand DownExpand Up@@ -237,7 +237,7 @@ void loopnd(
{
offset_t numel_batch = prod(fullsize, nbatch);
offset_t numel_spatial = prod<ndim>(fullsize+nbatch);
long grain_size = max(GRAIN_SIZE/numel_spatial, 1L);
long grain_size = (long) max<int64_t>(GRAIN_SIZE/numel_spatial, 1);
parallel_for(0, numel_batch, grain_size, [&](long start, long end) {
for (offset_t i=start; i < end; ++i)
{
Expand Down