Merge branch 'privatestaging' of https://github.com/AMDComputeLibraries/HIP-privatestaging into privatestaging

[ROCm/hip commit: 11c22b24b7]
This commit is contained in:
Ben Sander
2016-04-07 15:55:35 -05:00
bovenliggende 0da0662dba 7e9aa103d6
commit bc45411c71
10 gewijzigde bestanden met toevoegingen van 67 en 38 verwijderingen
+17 -6
Bestand weergeven
@@ -40,7 +40,6 @@ $CODEXL_PATH = $ENV{'CODEXL_PATH'};
$CODEXL_PATH = "/opt/AMD/CodeXL" unless defined $CODEXL_PATH;
$marker_path = "$CODEXL_PATH/SDK/AMDTActivityLogger";
#---
#HIP_PLATFORM controls whether to use NVCC or HCC for compilation:
$HIP_PLATFORM=$ENV{'HIP_PLATFORM'};
@@ -56,7 +55,7 @@ if ($verbose & 0x2) {
print ("CUDA_PATH=$CUDA_PATH\n");
}
$enablestdcpplib = 0;
if ($HIP_PLATFORM eq "hcc") {
$HSA_PATH=$ENV{'HSA_PATH'};
@@ -67,15 +66,17 @@ if ($HIP_PLATFORM eq "hcc") {
# HCC* may be used to compile src/hip_hcc.o (and also feed the HIPCXXFLAGS below)
$HCC = "$HCC_HOME/bin/hcc";
$HCCFLAGS = " -hc -I$HCC_HOME/include -stdlib=libc++";
$HCCFLAGS = " -hc -I$HCC_HOME/include ";
$HIPCC=$HCC;
$HIPCXXFLAGS = $HCCFLAGS;
$HIPCXXFLAGS .= " -I$HIP_PATH/include/hcc_detail/cuda";
$HIPCXXFLAGS .= " -I$HSA_PATH/include";
$HIPLDFLAGS = "-hc -L$HCC_HOME/lib -Wl,--rpath=$HCC_HOME/lib -lc++ -ldl -lpthread -Wl,--whole-archive -lmcwamp -Wl,--no-whole-archive";
# Suppress linker warnings in case HCC distribution contains OpenCL/SPIR symbols
$HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0";
# Suppress linker warnings in case HCC distribution contains OpenCL/SPIR symbols
$HIPLDFLAGS .= " -Wl,--defsym=_binary_kernel_spir_end=0 -Wl,--defsym=_binary_kernel_spir_start=0 -Wl,--defsym=_binary_kernel_cl_start=0 -Wl,--defsym=_binary_kernel_cl_end=0";
# Satisfy HCC dependencies
$HIPLDFLAGS .= " -lc++abi";
$HIPLDFLAGS .= " -L$HSA_PATH/lib -lhsa-runtime64 -lhc_am";
# Add trace marker library:
@@ -142,6 +143,11 @@ foreach $arg (@ARGV)
$needLDFLAGS = 1;
}
if($arg eq '-stdlib=libstdc++' and $enablestdcpplib eq 0)
{
$HIPCXXFLAGS .= " -stdlib=libstdc++";
$enablestdcpplib = 1;
}
if ($arg =~ m/^-/) {
# options start with -
@@ -181,13 +187,18 @@ if ($hasCU and $HIP_PLATFORM eq 'hcc') {
$HIPCXXFLAGS .= " -x c++";
}
if ($enablestdcpplib eq 0 and $HIP_PLATFORM eq 'hcc')
{
$HIPCXXFLAGS .= " -stdlib=libc++";
}
if ($needHipHcc) {
$HIP_USE_SHARED_LIBRARY = $ENV{'HIP_USE_SHARED_LIBRARY'};
$HIP_USE_SHARED_LIBRARY = 0 unless defined $HIP_USE_SHARED_LIBRARY;
#$HIPLDFLAGS .= " -L/opt/hip/lib -lhip_hcc" ;
if ($HIP_USE_SHARED_LIBRARY) {
$HIPLDFLAGS .= " -L$HIP_PATH/lib -Wl,--rpath=$HIP_PATH/lib -lhip_hcc"
$HIPLDFLAGS .= " -L$HIP_PATH/lib -Wl,--rpath=$HIP_PATH/lib -lhip_hcc";
} else {
$HIPLDFLAGS .= " $HIP_PATH/lib/device_util.cpp.o $HIP_PATH/lib/hip_device.cpp.o $HIP_PATH/lib/hip_error.cpp.o $HIP_PATH/lib/hip_event.cpp.o $HIP_PATH/lib/hip_hcc.cpp.o $HIP_PATH/lib/hip_memory.cpp.o $HIP_PATH/lib/hip_peer.cpp.o $HIP_PATH/lib/hip_stream.cpp.o $HIP_PATH/lib/staging_buffer.cpp.o";
}
+8
Bestand weergeven
@@ -0,0 +1,8 @@
#ifndef HCC_H
#define HCC_H
#if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
#include <hcc_detail/hcc_acc.h>
#endif
#endif
@@ -0,0 +1,20 @@
#ifndef HCC_ACC_H
#define HCC_ACC_H
#include "hip_runtime_api.h"
#if __cplusplus
#ifdef __HCC__
#include <hc.hpp>
/**
* @brief Return hc::accelerator associated with the specified deviceId
*/
hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc);
/**
* @brief Return hc::accelerator_view associated with the specified stream
*/
hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av);
#endif
#endif
#endif
@@ -1041,20 +1041,6 @@ hipError_t hipDriverGetVersion(int *driverVersion) ;
* @endcode
*
*/
#if __cplusplus
#ifdef __HCC__
#include <hc.hpp>
/**
* @brief Return hc::accelerator associated with the specified deviceId
*/
hipError_t hipHccGetAccelerator(int deviceId, hc::accelerator *acc);
/**
* @brief Return hc::accelerator_view associated with the specified stream
*/
hipError_t hipHccGetAcceleratorView(hipStream_t stream, hc::accelerator_view **av);
#endif
#endif
// end-group HCC_Specific
/**
@@ -29,8 +29,12 @@ THE SOFTWARE.
#error("This version of HIP requires a newer version of HCC.");
#endif
#if __cplusplus
#include <hc_short_vector.hpp>
using namespace hc::short_vector;
#endif
//-- Signed
// Define char vector types
typedef hc::short_vector::char1 char1;
@@ -108,7 +112,7 @@ typedef hc::short_vector::double2 double2;
typedef hc::short_vector::double3 double3;
typedef hc::short_vector::double4 double4;
/*
///---
// Inline functions for creating vector types from basic types
#define ONE_COMPONENT_ACCESS(T, VT) inline VT make_ ##VT (T x) { VT t; t.x = x; return t; };
@@ -191,3 +195,4 @@ ONE_COMPONENT_ACCESS (double, double1);
TWO_COMPONENT_ACCESS (double, double2);
THREE_COMPONENT_ACCESS(double, double3);
FOUR_COMPONENT_ACCESS (double, double4);
*/
@@ -27,7 +27,9 @@ THE SOFTWARE.
#if defined(__HIP_PLATFORM_HCC__) && !defined (__HIP_PLATFORM_NVCC__)
#if __cplusplus
#include <hcc_detail/hip_vector_types.h>
#endif
#elif defined(__HIP_PLATFORM_NVCC__) && !defined (__HIP_PLATFORM_HCC__)
#include <vector_types.h>
#else
@@ -33,8 +33,6 @@ THE SOFTWARE.
void __global__
bit_extract_kernel(hipLaunchParm lp, uint32_t *C_d, const uint32_t *A_d, size_t N)
{
KERNELBEGIN;
size_t offset = (hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x);
size_t stride = hipBlockDim_x * hipGridDim_x ;
@@ -45,8 +43,6 @@ bit_extract_kernel(hipLaunchParm lp, uint32_t *C_d, const uint32_t *A_d, size_t
C_d[i] = ((A_d[i] & 0xf00) >> 8);
#endif
}
KERNELEND;
}
+1 -9
Bestand weergeven
@@ -137,7 +137,7 @@ ihipStream_t::ihipStream_t(unsigned device_index, hc::accelerator_view av, unsig
//---
ihipStream_t::~ihipStream_t()
{
{
}
@@ -899,7 +899,6 @@ void ihipInit()
for (int i=0; i<accs.size(); i++) {
// check if the device id is included in the HIP_VISIBLE_DEVICES env variable
if (! accs[i].get_is_emulated()) {
//if (std::find(g_hip_visible_devices.begin(), g_hip_visible_devices.end(), (i-1)) == g_hip_visible_devices.end() && g_visible_device)
if (std::find(g_hip_visible_devices.begin(), g_hip_visible_devices.end(), (i-1)) == g_hip_visible_devices.end() && g_visible_device)
{
//If device is not in visible devices list, ignore
@@ -933,13 +932,6 @@ bool ihipIsValidDevice(unsigned deviceIndex)
return (deviceIndex < g_deviceCnt);
}
/*// check if the device ID is set as visible*/
//INLINE bool ihipIsVisibleDevice(unsigned deviceIndex)
//{
//return std::find(g_hip_visible_devices.begin(), g_hip_visible_devices.end(),
//(int)deviceIndex) != g_hip_visible_devices.end();
/*}*/
//---
ihipDevice_t *ihipGetTlsDefaultDevice()
{
+12 -3
Bestand weergeven
@@ -8,7 +8,13 @@ include_directories( ${PROJECT_SOURCE_DIR}/include )
set (HIP_Unit_Test_VERSION_MAJOR 1)
set (HIP_Unit_Test_VERSION_MINOR 0)
set (HIP_BUILD_LOCAL 0)
if(NOT DEFINED HIP_BUILD_LOCAL)
if(NOT DEFINED ENV{HIP_BUILD_LOCAL})
set(HIP_BUILD_LOCAL 0 CACHE BOOL "Build HIP in local folder")
else()
set(HIP_BUILD_LOCAL $ENV{HIP_BUILD_LOCAL} CACHE BOOL "Build HIP in local folder")
endif()
endif()
set(HIP_PATH $ENV{HIP_PATH})
if (NOT DEFINED HIP_PATH)
@@ -75,9 +81,12 @@ add_library(test_common OBJECT test_common.cpp )
# usage : make_hip_executable (exe_name CPP_FILES)
macro (make_hip_executable exe cpp)
if (${HIP_PLATFORM} STREQUAL "hcc")
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
#add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
if (${HIP_BUILD_LOCAL})
target_link_libraries(${exe} hip_hcc)
#target_link_libraries(${exe} hip_hcc)
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> $<TARGET_OBJECTS:hip_hcc> )
else()
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
endif()
else()
add_executable (${exe} ${cpp} ${ARGN} $<TARGET_OBJECTS:test_common> )
+1 -1
Bestand weergeven
@@ -24,7 +24,7 @@ THE SOFTWARE.
#include <stdio.h>
#include <iostream>
#include <hip_runtime.h>
#include <hcc.h>
#include "test_common.h"
#define CHECK(error) \