Merge branch 'privatestaging' of https://github.com/AMDComputeLibraries/HIP-privatestaging into privatestaging
This commit is contained in:
@@ -168,7 +168,7 @@ if ($needHipHcc) {
|
|||||||
if ((not -e $object) or ((stat($source))[9] > (stat($object))[9])) {
|
if ((not -e $object) or ((stat($source))[9] > (stat($object))[9])) {
|
||||||
my $CMD = "$HCC $HCCFLAGS -I$HSA_PATH/include -I$HIP_PATH/include -Wall -c $source -o $object";
|
my $CMD = "$HCC $HCCFLAGS -I$HSA_PATH/include -I$HIP_PATH/include -Wall -c $source -o $object";
|
||||||
if ($verbose & 0x10) {
|
if ($verbose & 0x10) {
|
||||||
$CMD .= " -g -O2" ;
|
$CMD .= " -g -O0" ;
|
||||||
} else {
|
} else {
|
||||||
$CMD .= " -O3" ;
|
$CMD .= " -O3" ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ hipcc adds the necessary libraries for HIP as well as for the accelerator compil
|
|||||||
|
|
||||||
### -lm Option
|
### -lm Option
|
||||||
|
|
||||||
hcc does not add -lm by default. If you see errors about missing math functions at link time (e.g., "sqrt@@GLIBC_2.2.5"), ensure that -lm is in the link options.
|
hipcc adds -lm by default to the link command.
|
||||||
|
|
||||||
|
|
||||||
## Linking Code With Other Compilers
|
## Linking Code With Other Compilers
|
||||||
|
|||||||
@@ -275,6 +275,29 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
|
|||||||
return hipCUDAErrorTohipError(cerror);
|
return hipCUDAErrorTohipError(cerror);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline static hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr){
|
||||||
|
cudaPointerAttributes cPA;
|
||||||
|
hipError_t err = hipCUDAErrorTohipError(cudaPointerGetAttributes(&cPA, ptr));
|
||||||
|
if(err == hipSuccess){
|
||||||
|
switch (cPA.memoryType){
|
||||||
|
case cudaMemoryTypeDevice:
|
||||||
|
attributes->memoryType = hipMemoryTypeDevice; break;
|
||||||
|
case cudaMemoryTypeHost:
|
||||||
|
attributes->memoryType = hipMemoryTypeHost; break;
|
||||||
|
default:
|
||||||
|
return hipErrorUnknownSymbol;
|
||||||
|
}
|
||||||
|
attributes->device = cPA.device;
|
||||||
|
attributes->devicePointer = cPA.devicePointer;
|
||||||
|
attributes->hostPointer = cPA.hostPointer;
|
||||||
|
attributes->isManaged = 0;
|
||||||
|
attributes->allocationFlags = 0;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline static hipError_t hipMemGetInfo( size_t* free, size_t* total)
|
inline static hipError_t hipMemGetInfo( size_t* free, size_t* total)
|
||||||
{
|
{
|
||||||
return hipCUDAErrorTohipError(cudaMemGetInfo(free,total));
|
return hipCUDAErrorTohipError(cudaMemGetInfo(free,total));
|
||||||
|
|||||||
@@ -797,7 +797,7 @@ hipError_t ihipDevice_t::getProperties(hipDeviceProp_t* prop)
|
|||||||
// Group memory will not be paged out, so, the physical memory size is the total shared memory size, and also equal to the group region size.
|
// Group memory will not be paged out, so, the physical memory size is the total shared memory size, and also equal to the group region size.
|
||||||
prop->maxSharedMemoryPerMultiProcessor = prop->totalGlobalMem;
|
prop->maxSharedMemoryPerMultiProcessor = prop->totalGlobalMem;
|
||||||
|
|
||||||
#ifdef USE_ROCR_V2
|
#if USE_ROCR_V2
|
||||||
// Get Max memory clock frequency
|
// Get Max memory clock frequency
|
||||||
//err = hsa_region_get_info(*am_region, (hsa_region_info_t)HSA_AMD_REGION_INFO_MAX_CLOCK_FREQUENCY, &prop->memoryClockRate);
|
//err = hsa_region_get_info(*am_region, (hsa_region_info_t)HSA_AMD_REGION_INFO_MAX_CLOCK_FREQUENCY, &prop->memoryClockRate);
|
||||||
DeviceErrorCheck(err);
|
DeviceErrorCheck(err);
|
||||||
@@ -1330,12 +1330,10 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
|
|||||||
*pi = prop->regsPerBlock; break;
|
*pi = prop->regsPerBlock; break;
|
||||||
case hipDeviceAttributeClockRate:
|
case hipDeviceAttributeClockRate:
|
||||||
*pi = prop->clockRate; break;
|
*pi = prop->clockRate; break;
|
||||||
#ifdef USE_ROCR_V2
|
|
||||||
case hipDeviceAttributeMemoryClockRate:
|
case hipDeviceAttributeMemoryClockRate:
|
||||||
*pi = prop->memoryClockRate; break;
|
*pi = prop->memoryClockRate; break;
|
||||||
case hipDeviceAttributeMemoryBusWidth:
|
case hipDeviceAttributeMemoryBusWidth:
|
||||||
*pi = prop->memoryBusWidth; break;
|
*pi = prop->memoryBusWidth; break;
|
||||||
#endif
|
|
||||||
case hipDeviceAttributeMultiprocessorCount:
|
case hipDeviceAttributeMultiprocessorCount:
|
||||||
*pi = prop->multiProcessorCount; break;
|
*pi = prop->multiProcessorCount; break;
|
||||||
case hipDeviceAttributeComputeMode:
|
case hipDeviceAttributeComputeMode:
|
||||||
@@ -1798,7 +1796,12 @@ hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void* ptr)
|
|||||||
attributes->hostPointer = amPointerInfo._hostPointer;
|
attributes->hostPointer = amPointerInfo._hostPointer;
|
||||||
attributes->devicePointer = amPointerInfo._devicePointer;
|
attributes->devicePointer = amPointerInfo._devicePointer;
|
||||||
attributes->isManaged = 0;
|
attributes->isManaged = 0;
|
||||||
|
if(attributes->memoryType == hipMemoryTypeHost){
|
||||||
|
attributes->hostPointer = ptr;
|
||||||
|
}
|
||||||
|
if(attributes->memoryType == hipMemoryTypeDevice){
|
||||||
|
attributes->devicePointer = ptr;
|
||||||
|
}
|
||||||
attributes->allocationFlags = amPointerInfo._appAllocationFlags;
|
attributes->allocationFlags = amPointerInfo._appAllocationFlags;
|
||||||
attributes->device = amPointerInfo._appId;
|
attributes->device = amPointerInfo._appId;
|
||||||
|
|
||||||
@@ -2370,6 +2373,7 @@ hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind
|
|||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @result #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidMemcpyDirection, #hipErrorInvalidValue
|
* @result #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidMemcpyDirection, #hipErrorInvalidValue
|
||||||
|
* @warning on HCC hipMemcpyAsync does not support overlapped H2D and D2H copies.
|
||||||
*/
|
*/
|
||||||
//---
|
//---
|
||||||
hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
|
hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
|
||||||
|
|||||||
+24
-19
@@ -1,34 +1,39 @@
|
|||||||
Tests uses CMAKE as teh build infrastructure.
|
Tests uses CMAKE as teh build infrastructure.
|
||||||
|
|
||||||
Use :
|
Use :
|
||||||
|
```
|
||||||
> mkdir build
|
$ mkdir build
|
||||||
> cd build
|
$ cd build
|
||||||
> cmake ../src
|
$ cmake ../src
|
||||||
> make
|
$ make
|
||||||
> make test
|
$ make test
|
||||||
|
```
|
||||||
|
|
||||||
#-----
|
#-----
|
||||||
# How to add a new test;
|
### How to add a new test
|
||||||
|
|
||||||
# edit src/CMakeFiles to add the test:
|
edit src/CMakeFiles to add the test:
|
||||||
|
|
||||||
# add the executable and list of required CPP files, ie:
|
### add the executable and list of required CPP files, ie:
|
||||||
# make_test (EXE CPP_FILES)
|
```
|
||||||
> make_hip_executable (hipMemset hipMemset.cpp)
|
make_test (EXE CPP_FILES)
|
||||||
|
make_hip_executable (hipMemset hipMemset.cpp)
|
||||||
|
```
|
||||||
|
|
||||||
# Add to automated Test framework:
|
### Add to automated Test framework:
|
||||||
# make_test (TESTNAME ARGS)
|
```
|
||||||
> make_test(hipMemset " ")
|
make_test (TESTNAME ARGS)
|
||||||
|
make_test(hipMemset " ")
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Running tests:
|
||||||
# Running tests:
|
```
|
||||||
make test
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
# Run a specific test:
|
# Run a specific test:
|
||||||
|
```
|
||||||
./hipMemset
|
./hipMemset
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -135,13 +135,13 @@ void testSimple()
|
|||||||
resetAttribs(&attribs2);
|
resetAttribs(&attribs2);
|
||||||
HIPCHECK( hipPointerGetAttributes(&attribs2, A_d+100));
|
HIPCHECK( hipPointerGetAttributes(&attribs2, A_d+100));
|
||||||
printf("getAttr:%-20s", "A_d+100"); printAttribs(&attribs2);
|
printf("getAttr:%-20s", "A_d+100"); printAttribs(&attribs2);
|
||||||
HIPASSERT(attribs == attribs2);
|
HIPASSERT((char*)attribs.devicePointer+100 == (char*)attribs2.devicePointer);
|
||||||
|
|
||||||
// Corner case at end of array:
|
// Corner case at end of array:
|
||||||
resetAttribs(&attribs2);
|
resetAttribs(&attribs2);
|
||||||
HIPCHECK( hipPointerGetAttributes(&attribs2, A_d+Nbytes-1));
|
HIPCHECK( hipPointerGetAttributes(&attribs2, A_d+Nbytes-1));
|
||||||
printf("getAttr:%-20s", "A_d+NBytes-1"); printAttribs(&attribs2);
|
printf("getAttr:%-20s", "A_d+Nbytes-1"); printAttribs(&attribs2);
|
||||||
HIPASSERT(attribs == attribs2);
|
HIPASSERT((char*)attribs.devicePointer+Nbytes-1 == (char*)attribs2.devicePointer);
|
||||||
|
|
||||||
// Pointer just beyond array - must be invalid or at least a different pointer
|
// Pointer just beyond array - must be invalid or at least a different pointer
|
||||||
resetAttribs(&attribs2);
|
resetAttribs(&attribs2);
|
||||||
@@ -150,7 +150,7 @@ void testSimple()
|
|||||||
if (e != hipErrorInvalidValue) {
|
if (e != hipErrorInvalidValue) {
|
||||||
// We might have strayed into another pointer area.
|
// We might have strayed into another pointer area.
|
||||||
printf("getAttr:%-20s", "A_d+NBytes"); printAttribs(&attribs2);
|
printf("getAttr:%-20s", "A_d+NBytes"); printAttribs(&attribs2);
|
||||||
HIPASSERT(attribs.devicePointer != attribs2.devicePointer);
|
HIPASSERT((char*)attribs.devicePointer != (char*)attribs2.devicePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ void testSimple()
|
|||||||
resetAttribs(&attribs2);
|
resetAttribs(&attribs2);
|
||||||
HIPCHECK( hipPointerGetAttributes(&attribs2, A_Pinned_h+Nbytes/2));
|
HIPCHECK( hipPointerGetAttributes(&attribs2, A_Pinned_h+Nbytes/2));
|
||||||
printf("getAttr:%-20s", "A_pinned_h+NBytes/2"); printAttribs(&attribs2);
|
printf("getAttr:%-20s", "A_pinned_h+NBytes/2"); printAttribs(&attribs2);
|
||||||
HIPASSERT(attribs == attribs2);
|
HIPASSERT((char*)attribs.hostPointer+Nbytes/2 == (char*)attribs2.hostPointer);
|
||||||
|
|
||||||
|
|
||||||
hipFreeHost(A_Pinned_h);
|
hipFreeHost(A_Pinned_h);
|
||||||
@@ -233,7 +233,7 @@ void checkPointer(SuperPointerAttribute &ref, int major, int minor, void *pointe
|
|||||||
printf(" ref :: "); printAttribs(&ref._attrib);
|
printf(" ref :: "); printAttribs(&ref._attrib);
|
||||||
printf(" getattr:: "); printAttribs(&attribs);
|
printf(" getattr:: "); printAttribs(&attribs);
|
||||||
|
|
||||||
HIPASSERT(attribs == ref._attrib);
|
HIPASSERT(attribs != ref._attrib);
|
||||||
} else {
|
} else {
|
||||||
if (p_verbose & 0x1) {
|
if (p_verbose & 0x1) {
|
||||||
printf("#%4d.%d GOOD:%p getattr :: ",major, minor, pointer); printAttribs(&attribs);
|
printf("#%4d.%d GOOD:%p getattr :: ",major, minor, pointer); printAttribs(&attribs);
|
||||||
|
|||||||
Viittaa uudesa ongelmassa
Block a user