2017-02-14 21:50:16 -06:00
|
|
|
/*
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* HIT_START
|
2017-05-27 15:55:07 -05:00
|
|
|
* BUILD: %t %s ../../test_common.cpp NVCC_OPTIONS --std=c++11
|
2017-02-14 21:50:16 -06:00
|
|
|
* RUN: %t
|
|
|
|
|
* HIT_END
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "hip/hip_runtime.h"
|
|
|
|
|
#include "test_common.h"
|
|
|
|
|
#include <vector>
|
2018-03-12 11:29:03 +05:30
|
|
|
unsigned p_streams = 16;
|
|
|
|
|
int p_repeat = 10;
|
|
|
|
|
int p_db = 0;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
2018-10-17 12:01:44 +05:30
|
|
|
__global__ void vectorADDRepeat(const T* A_d, const T* B_d, T* C_d, size_t NELEM,
|
2018-03-12 11:29:03 +05:30
|
|
|
int repeat) {
|
2017-11-29 21:49:10 +00:00
|
|
|
size_t offset = (blockIdx.x * blockDim.x + threadIdx.x);
|
2018-03-12 11:29:03 +05:30
|
|
|
size_t stride = blockDim.x * gridDim.x;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
for (int j = 1; j <= repeat; j++) {
|
|
|
|
|
for (size_t i = offset; i < NELEM; i += stride) {
|
|
|
|
|
C_d[i] = A_d[i] * j + B_d[i] * j;
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------
|
|
|
|
|
// Structure for one stream - includes the stream + data buffers that are used by the stream.
|
|
|
|
|
template <typename T>
|
|
|
|
|
class Streamer {
|
2018-03-12 11:29:03 +05:30
|
|
|
public:
|
|
|
|
|
Streamer(size_t numElements, bool useNullStream = false);
|
2017-02-14 21:50:16 -06:00
|
|
|
~Streamer();
|
|
|
|
|
void enqueAsync();
|
|
|
|
|
void queryUntilComplete();
|
|
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
void reset();
|
|
|
|
|
void H2D();
|
|
|
|
|
void D2H();
|
|
|
|
|
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
public:
|
|
|
|
|
T* _A_h;
|
|
|
|
|
T* _B_h;
|
|
|
|
|
T* _C_h;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
T* _A_d;
|
|
|
|
|
T* _B_d;
|
|
|
|
|
T* _C_d;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
hipStream_t _stream;
|
2018-03-12 11:29:03 +05:30
|
|
|
hipEvent_t _event;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
size_t _numElements;
|
2017-02-14 21:50:16 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
Streamer<T>::Streamer(size_t numElements, bool useNullStream) : _numElements(numElements) {
|
|
|
|
|
HipTest::initArrays(&_A_d, &_B_d, &_C_d, &_A_h, &_B_h, &_C_h, numElements, true);
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
if (useNullStream) {
|
|
|
|
|
_stream = 0x0;
|
|
|
|
|
} else {
|
|
|
|
|
HIPCHECK(hipStreamCreate(&_stream));
|
|
|
|
|
}
|
|
|
|
|
HIPCHECK(hipEventCreate(&_event));
|
2017-05-12 17:04:23 -05:00
|
|
|
|
|
|
|
|
H2D();
|
2017-02-14 21:50:16 -06:00
|
|
|
};
|
|
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
void Streamer<T>::H2D() {
|
|
|
|
|
HIPCHECK(hipMemcpy(_A_d, _A_h, _numElements * sizeof(T), hipMemcpyHostToDevice));
|
|
|
|
|
HIPCHECK(hipMemcpy(_B_d, _B_h, _numElements * sizeof(T), hipMemcpyHostToDevice));
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
void Streamer<T>::D2H() {
|
|
|
|
|
HIPCHECK(hipMemcpy(_C_h, _C_d, _numElements * sizeof(T), hipMemcpyDeviceToHost));
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
void Streamer<T>::reset() {
|
2017-05-12 17:04:23 -05:00
|
|
|
HipTest::setDefaultData(_numElements, _A_h, _B_h, _C_h);
|
|
|
|
|
H2D();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-02-14 21:50:16 -06:00
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
void Streamer<T>::enqueAsync() {
|
|
|
|
|
printf("testing: %s numElements=%zu size=%6.2fMB\n", __func__, _numElements,
|
|
|
|
|
_numElements * sizeof(T) / 1024.0 / 1024.0);
|
2017-02-14 21:50:16 -06:00
|
|
|
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, _numElements);
|
2018-10-17 12:01:44 +05:30
|
|
|
hipLaunchKernelGGL(vectorADDRepeat, dim3(blocks), dim3(threadsPerBlock), 0, _stream,
|
2018-03-12 11:29:03 +05:30
|
|
|
static_cast<const T*>(_A_d), static_cast<const T*>(_B_d), _C_d, _numElements,
|
|
|
|
|
p_repeat);
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
2018-03-12 11:29:03 +05:30
|
|
|
void Streamer<T>::queryUntilComplete() {
|
2017-02-14 21:50:16 -06:00
|
|
|
int numQueries = 0;
|
|
|
|
|
hipError_t e = hipSuccess;
|
|
|
|
|
do {
|
|
|
|
|
numQueries++;
|
|
|
|
|
e = hipStreamQuery(_stream);
|
2018-03-12 11:29:03 +05:30
|
|
|
} while (e != hipSuccess);
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
printf("completed after %d queries\n", numQueries);
|
2017-02-14 21:50:16 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---
|
2018-03-12 11:29:03 +05:30
|
|
|
// Parse arguments specific to this test.
|
|
|
|
|
void parseMyArguments(int argc, char* argv[]) {
|
2017-02-14 21:50:16 -06:00
|
|
|
int more_argc = HipTest::parseStandardArguments(argc, argv, false);
|
|
|
|
|
|
|
|
|
|
// parse args for this test:
|
|
|
|
|
for (int i = 1; i < more_argc; i++) {
|
2018-03-12 11:29:03 +05:30
|
|
|
const char* arg = argv[i];
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
if (!strcmp(arg, "--streams")) {
|
|
|
|
|
if (++i >= argc || !HipTest::parseUInt(argv[i], &p_streams)) {
|
2018-03-12 11:29:03 +05:30
|
|
|
failed("Bad streams argument");
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
2017-05-12 17:04:23 -05:00
|
|
|
} else if (!strcmp(arg, "--repeat") || (!strcmp(arg, "-r"))) {
|
|
|
|
|
if (++i >= argc || !HipTest::parseInt(argv[i], &p_repeat)) {
|
2018-03-12 11:29:03 +05:30
|
|
|
failed("Bad repeat argument");
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
2017-02-14 21:50:16 -06:00
|
|
|
} else {
|
|
|
|
|
failed("Bad argument '%s'", arg);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
void printBuffer(std::string name, int* f, size_t numElements) {
|
2017-05-12 17:04:23 -05:00
|
|
|
std::cout << name << "\n";
|
2018-03-12 11:29:03 +05:30
|
|
|
for (size_t i = 0; i < numElements; i++) {
|
|
|
|
|
printf("%5zu: %d\n", i, f[i]);
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
//---
|
2018-03-12 11:29:03 +05:30
|
|
|
int main(int argc, char* argv[]) {
|
2017-02-14 21:50:16 -06:00
|
|
|
HipTest::parseStandardArguments(argc, argv, false);
|
|
|
|
|
parseMyArguments(argc, argv);
|
|
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
typedef Streamer<int> IntStreamer;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
std::vector<IntStreamer*> streamers;
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
size_t numElements = N;
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
int* expected_H = (int*)malloc(numElements * sizeof(int));
|
2017-05-12 17:04:23 -05:00
|
|
|
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
auto nullStreamer = new IntStreamer(numElements, true);
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
// Expected resultr - last streamer runs vectorADDRepeat, then nullstreamer adds
|
|
|
|
|
// lastStreamer->_C_d + lastStreamer->_C_d
|
|
|
|
|
for (size_t i = 0; i < numElements; i++) {
|
|
|
|
|
expected_H[i] =
|
|
|
|
|
((nullStreamer->_A_h[i]) * p_repeat + (nullStreamer->_B_h[i]) * p_repeat) * 2;
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
for (int i = 0; i < p_streams; i++) {
|
|
|
|
|
IntStreamer* s = new IntStreamer(numElements);
|
2017-02-14 21:50:16 -06:00
|
|
|
streamers.push_back(s);
|
|
|
|
|
}
|
2017-05-12 17:04:23 -05:00
|
|
|
unsigned blocks = HipTest::setNumBlocks(blocksPerCU, threadsPerBlock, numElements);
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
for (int s = 1; s < p_streams; s++) {
|
|
|
|
|
if (p_tests & (1 << s)) {
|
|
|
|
|
printf("==> Test %x runAsnc, #streams=%d\n", (1 << s), s);
|
2017-05-12 17:04:23 -05:00
|
|
|
nullStreamer->reset();
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
for (int i = 0; i < s; i++) {
|
2017-05-12 17:04:23 -05:00
|
|
|
streamers[i]->enqueAsync();
|
|
|
|
|
}
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
auto lastStreamer = streamers[s - 1];
|
2017-02-14 21:50:16 -06:00
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
// Dispatch to NULL stream, should wait for prior async activity to complete before
|
|
|
|
|
// beginning:
|
2018-10-17 12:01:44 +05:30
|
|
|
hipLaunchKernelGGL(vectorADDRepeat, dim3(blocks), dim3(threadsPerBlock), 0,
|
2018-03-12 11:29:03 +05:30
|
|
|
0 /*nullstream*/, static_cast<const int*>(lastStreamer->_C_d),
|
|
|
|
|
static_cast<const int*>(lastStreamer->_C_d), nullStreamer->_C_d,
|
|
|
|
|
numElements, 1 /*repeat*/);
|
2017-05-12 17:04:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if (p_db) {
|
|
|
|
|
HIPCHECK(hipDeviceSynchronize());
|
|
|
|
|
lastStreamer->D2H();
|
|
|
|
|
printBuffer("lastStream _A_h", lastStreamer->_A_h, min(numElements, size_t(20)));
|
|
|
|
|
printBuffer("lastStream _B_h", lastStreamer->_B_h, min(numElements, size_t(20)));
|
|
|
|
|
printBuffer("lastStream _C_h", lastStreamer->_C_h, min(numElements, size_t(20)));
|
|
|
|
|
}
|
|
|
|
|
nullStreamer->D2H();
|
|
|
|
|
HIPCHECK(hipDeviceSynchronize());
|
2017-02-14 21:50:16 -06:00
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
HipTest::checkTest(expected_H, nullStreamer->_C_h, numElements);
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
for (int s = 1; s < p_streams; s += 2) {
|
|
|
|
|
unsigned tmask = (0x10000 | (1 << s));
|
2017-05-12 17:04:23 -05:00
|
|
|
if (p_tests & tmask) {
|
|
|
|
|
nullStreamer->reset();
|
2018-03-12 11:29:03 +05:30
|
|
|
printf("==> Test %x runAsnc-odd-only, #streams=%d\n", tmask, s);
|
|
|
|
|
for (int i = 0; i < s; i++) {
|
2017-05-12 17:04:23 -05:00
|
|
|
// RUn just odd streams so we have some empty ones to examine/optimize:
|
|
|
|
|
if (i & 0x1) {
|
|
|
|
|
streamers[i]->enqueAsync();
|
|
|
|
|
}
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
2017-05-12 17:04:23 -05:00
|
|
|
auto lastStreamer = streamers[s - 1];
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
// Dispatch to NULL stream, should wait for prior async activity to complete before
|
|
|
|
|
// beginning:
|
2018-10-17 12:01:44 +05:30
|
|
|
hipLaunchKernelGGL(vectorADDRepeat, dim3(blocks), dim3(threadsPerBlock), 0,
|
2018-03-12 11:29:03 +05:30
|
|
|
0 /*nullstream*/, static_cast<const int*>(lastStreamer->_C_d),
|
|
|
|
|
static_cast<const int*>(lastStreamer->_C_d), nullStreamer->_C_d,
|
|
|
|
|
numElements, 1 /*repeat*/);
|
2017-05-12 17:04:23 -05:00
|
|
|
|
|
|
|
|
nullStreamer->D2H();
|
|
|
|
|
|
|
|
|
|
HIPCHECK(hipDeviceSynchronize());
|
|
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
HipTest::checkTest(expected_H, nullStreamer->_C_h, numElements);
|
2017-02-14 21:50:16 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
// Expected resultr - last streamer runs vectorADDRepeat
|
2018-03-12 11:29:03 +05:30
|
|
|
for (size_t i = 0; i < numElements; i++) {
|
|
|
|
|
expected_H[i] = ((nullStreamer->_A_h[i]) * p_repeat + (nullStreamer->_B_h[i]) * p_repeat);
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (p_tests & 0x20000) {
|
2018-03-12 11:29:03 +05:30
|
|
|
assert(p_streams >= 2); // need a couple streams in order to run this test.
|
2017-05-12 17:04:23 -05:00
|
|
|
nullStreamer->reset();
|
2018-03-12 11:29:03 +05:30
|
|
|
printf("\n==> Test hipStreamSynchronize with defaultStream \n");
|
2017-05-12 17:04:23 -05:00
|
|
|
|
|
|
|
|
// Enqueue a long-running job to stream1
|
|
|
|
|
streamers[0]->enqueAsync();
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
// Check to see if synchronizing on a null stream synchronizes all other streams or just the
|
|
|
|
|
// null stream. This function follows null stream semantics and will wait for all other
|
|
|
|
|
// blocking streams before returning. This will wait on the host
|
2017-05-12 17:04:23 -05:00
|
|
|
HIPCHECK(hipStreamSynchronize(0));
|
|
|
|
|
|
2018-03-12 11:29:03 +05:30
|
|
|
// Copy with stream1, this could go async if the streamSync doesn't synchronize ALL the
|
|
|
|
|
// streams.
|
|
|
|
|
HIPCHECK(hipMemcpyAsync(streamers[0]->_C_h, streamers[0]->_C_d,
|
|
|
|
|
streamers[0]->_numElements * sizeof(int), hipMemcpyDeviceToHost,
|
|
|
|
|
streamers[1]->_stream));
|
2017-05-12 17:04:23 -05:00
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
|
2017-05-12 17:04:23 -05:00
|
|
|
HIPCHECK(hipDeviceSynchronize());
|
|
|
|
|
|
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
2017-11-01 15:09:59 +00:00
|
|
|
HipTest::checkTest(expected_H, streamers[0]->_C_h, numElements);
|
2017-05-12 17:04:23 -05:00
|
|
|
}
|
|
|
|
|
|
2017-02-14 21:50:16 -06:00
|
|
|
|
|
|
|
|
passed();
|
|
|
|
|
}
|