able to pass non-dim launch parm to kernel launch

Change-Id: I0411849a27efcba597a1a9aa08be179635e04988
Šī revīzija ir iekļauta:
Aditya Atluri
2016-06-18 11:28:20 -05:00
vecāks 763dd0cb76
revīzija ffcfc95360
4 mainīti faili ar 104 papildinājumiem un 10 dzēšanām
@@ -529,7 +529,10 @@ __device__ float __dsqrt_rz(double x);
#define HIP_KERNEL_NAME(...) __VA_ARGS__
#ifdef __HCC_CPP__
hipStream_t ihipPreLaunchKernel(hipStream_t stream, grid_launch_parm *lp);
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_launch_parm *lp);
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, size_t block, grid_launch_parm *lp);
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, dim3 block, grid_launch_parm *lp);
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, size_t block, grid_launch_parm *lp);
void ihipPostLaunchKernel(hipStream_t stream, grid_launch_parm &lp);
// TODO - move to common header file.
@@ -540,14 +543,8 @@ void ihipPostLaunchKernel(hipStream_t stream, grid_launch_parm &lp);
#define hipLaunchKernel(_kernelName, _numBlocks3D, _blockDim3D, _groupMemBytes, _stream, ...) \
do {\
grid_launch_parm lp;\
lp.gridDim.x = _numBlocks3D.x; \
lp.gridDim.y = _numBlocks3D.y; \
lp.gridDim.z = _numBlocks3D.z; \
lp.groupDim.x = _blockDim3D.x; \
lp.groupDim.y = _blockDim3D.y; \
lp.groupDim.z = _blockDim3D.z; \
lp.groupMemBytes = _groupMemBytes; \
hipStream_t trueStream = (ihipPreLaunchKernel(_stream, &lp)); \
hipStream_t trueStream = (ihipPreLaunchKernel(_stream, _numBlocks3D, _blockDim3D, &lp)); \
if (HIP_TRACE_API) {\
fprintf(stderr, KGRN "<<hip-api: hipLaunchKernel '%s' gridDim:(%d,%d,%d) groupDim:(%d,%d,%d) groupMem:+%d stream=%p\n" KNRM, \
#_kernelName, lp.gridDim.x, lp.gridDim.y, lp.gridDim.z, lp.groupDim.x, lp.groupDim.y, lp.groupDim.z, lp.groupMemBytes, (void*)(_stream));\
+61 -1
Parādīt failu
@@ -1087,12 +1087,72 @@ hipStream_t ihipSyncAndResolveStream(hipStream_t stream)
// TODO - data-up to data-down:
// Called just before a kernel is launched from hipLaunchKernel.
// Allows runtime to track some information about the stream.
hipStream_t ihipPreLaunchKernel(hipStream_t stream, grid_launch_parm *lp)
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, dim3 block, grid_launch_parm *lp)
{
std::call_once(hip_initialized, ihipInit);
stream = ihipSyncAndResolveStream(stream);
lp->gridDim.x = grid.x;
lp->gridDim.y = grid.y;
lp->gridDim.z = grid.z;
lp->groupDim.x = block.x;
lp->groupDim.y = block.y;
lp->groupDim.z = block.z;
stream->lockopen_preKernelCommand();
// *av = &stream->_av;
lp->av = &stream->_av;
lp->cf = new hc::completion_future;
// lp->av = static_cast<void*>(av);
// lp->cf = static_cast<void*>(malloc(sizeof(hc::completion_future)));
return (stream);
}
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, dim3 block, grid_launch_parm *lp)
{
std::call_once(hip_initialized, ihipInit);
stream = ihipSyncAndResolveStream(stream);
lp->gridDim.x = grid;
lp->gridDim.y = 0;
lp->gridDim.z = 0;
lp->groupDim.x = block.x;
lp->groupDim.y = block.y;
lp->groupDim.z = block.z;
stream->lockopen_preKernelCommand();
// *av = &stream->_av;
lp->av = &stream->_av;
lp->cf = new hc::completion_future;
// lp->av = static_cast<void*>(av);
// lp->cf = static_cast<void*>(malloc(sizeof(hc::completion_future)));
return (stream);
}
hipStream_t ihipPreLaunchKernel(hipStream_t stream, dim3 grid, size_t block, grid_launch_parm *lp)
{
std::call_once(hip_initialized, ihipInit);
stream = ihipSyncAndResolveStream(stream);
lp->gridDim.x = grid.x;
lp->gridDim.y = grid.y;
lp->gridDim.z = grid.z;
lp->groupDim.x = block;
lp->groupDim.y = 0;
lp->groupDim.z = 0;
stream->lockopen_preKernelCommand();
// *av = &stream->_av;
lp->av = &stream->_av;
lp->cf = new hc::completion_future;
// lp->av = static_cast<void*>(av);
// lp->cf = static_cast<void*>(malloc(sizeof(hc::completion_future)));
return (stream);
}
hipStream_t ihipPreLaunchKernel(hipStream_t stream, size_t grid, size_t block, grid_launch_parm *lp)
{
std::call_once(hip_initialized, ihipInit);
stream = ihipSyncAndResolveStream(stream);
lp->gridDim.x = grid;
lp->gridDim.y = 0;
lp->gridDim.z = 0;
lp->groupDim.x = block;
lp->groupDim.y = 0;
lp->groupDim.z = 0;
stream->lockopen_preKernelCommand();
// *av = &stream->_av;
lp->av = &stream->_av;
+2 -1
Parādīt failu
@@ -178,10 +178,11 @@ build_hip_executable (hipFuncDeviceSynchronize hipFuncDeviceSynchronize.cpp)
build_hip_executable (hipPeerToPeer_simple hipPeerToPeer_simple.cpp)
build_hip_executable (hipTestMemcpyPin hipTestMemcpyPin.cpp)
#build_hip_executable (hipDynamicShared hipDynamicShared.cpp)
build_hip_executable (hipLaunchParm hipLaunchParm.cpp)
make_test(hipEventRecord --iterations 10)
make_test(hipEnvVarDriver " " )
make_test(hipLaunchParm " ")
#TODO -reenable
#make_test(hipPointerAttrib " " )
+36
Parādīt failu
@@ -0,0 +1,36 @@
/*
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include"hip_runtime.h"
#include"test_common.h"
#include"hip_runtime_api.h"
#include<iostream>
__global__ void vAdd(hipLaunchParm lp, float *a){}
int main()
{
float *Ad;
hipMalloc((void**)&Ad, 1024);
hipLaunchKernel(vAdd, 1024, 1, 0, 0, Ad);
hipLaunchKernel(vAdd, 1024, dim3(1), 0, 0, Ad);
hipLaunchKernel(vAdd, dim3(1024), 1, 0, 0, Ad);
hipLaunchKernel(vAdd, dim3(1024), dim3(1), 0, 0, Ad);
passed();
}