FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix convolve3 launch configuration in CUDA backend · arrayfire/arrayfire@b5286ef · GitHub

Repository navigation

Commit b5286ef

Browse files
authored andcommitted
Fix convolve3 launch configuration in CUDA backend
Batched input of Convolve3 was incorrectly folding batch size into CUDA launch grid's y & z dimensions. Since the batch for 3d inputs can happen along 4th dimension only, folding it onto x dimesion of CUDA grid is sufficient.
1 parent b811f87 commit b5286ef

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎src/backend/cuda/kernel/convolve.hpp‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ void prepareKernelArgs(conv_kparam_t& params, dim_t oDims[], dim_t fDims[],
9898
(params.mThreads.y + 2 * (fDims[1] - 1)) *
9999
(params.mThreads.z + 2 * (fDims[2] - 1)) *
100100
sizeof(T);
101-
// todo: fold into x dimension according to old style
102-
params.mBlocks.z = divup(params.mBlocks.y, maxBlocksY);
103-
params.mBlocks.y = divup(params.mBlocks.y, params.mBlocks.z);
104101
}
105102
}
106103

‎test/convolve.cpp‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,3 +804,23 @@ TEST(DISABLED_ConvolveLargeDim3D, CPP) {
804804
// TODO: fix product by indexing
805805
// ASSERT_EQ(1.f, product<float>(output));
806806
}
807+
808+
TEST(Convolve, CuboidBatchLaunchBugFix) {
809+
std::string testFile(TEST_DIR "/convolve/conv3d_launch_bug.test");
810+
811+
vector<dim4> numDims;
812+
vector< vector<float> > in;
813+
vector< vector<float> > tests;
814+
815+
readTests<float, float, float>(testFile, numDims, in, tests);
816+
817+
dim4 sDims = numDims[0];
818+
dim4 fDims = numDims[1];
819+
820+
af::array signal(sDims, in[0].data());
821+
af::array filter(fDims, in[1].data());
822+
823+
af::array output = convolve3(signal, filter);
824+
825+
ASSERT_VEC_ARRAY_NEAR(tests[0], sDims, output, 1.0e-3);
826+
}

‎test/data‎

Submodule data updated from 2ef3476 to 1074f2c

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL