IPC prototyps and part of the implementation included
Change-Id: Id88c7f155d23ec63f57a6ef05098fba43f8af336
[ROCm/hip commit: 17b98d59b8]
Этот коммит содержится в:
@@ -14,8 +14,7 @@ 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,
|
||||
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.
|
||||
*/
|
||||
@@ -2587,7 +2586,18 @@ __HIP_DEVICE__ double4 make_double4(double x, double y, double z, double w)
|
||||
return d4;
|
||||
}
|
||||
|
||||
__device__ void __threadfence_system(void){
|
||||
|
||||
__HIP_DEVICE__ double __longlong_as_double(long long int x)
|
||||
{
|
||||
return static_cast<double>(x);
|
||||
}
|
||||
|
||||
__HIP_DEVICE__ long long __double_as_longlong(double x)
|
||||
{
|
||||
return static_cast<long long>(x);
|
||||
}
|
||||
|
||||
__HIP_DEVICE__ void __threadfence_system(void){
|
||||
// no-op
|
||||
}
|
||||
|
||||
@@ -3380,3 +3390,5 @@ __host__ double norm4d(double a, double b, double c, double d)
|
||||
{
|
||||
return std::sqrt(a*a + b*b + c*c + d*d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ THE SOFTWARE.
|
||||
|
||||
#include <hc.hpp>
|
||||
#include <hsa/hsa.h>
|
||||
#include "hsa/hsa_ext_amd.h"
|
||||
#include "hip_util.h"
|
||||
|
||||
|
||||
@@ -367,6 +368,26 @@ struct LockedBase {
|
||||
MUTEX_TYPE _mutex;
|
||||
};
|
||||
|
||||
/**
|
||||
* HIP IPC Handle Size
|
||||
*/
|
||||
#define HIP_IPC_HANDLE_SIZE 64
|
||||
struct __HIP_DEVICE__ ihipIpcMemHandle
|
||||
{
|
||||
volatile hsa_amd_ipc_memory_t handle; ///< ipc memory handle on ROCr
|
||||
char reserved[HIP_IPC_HANDLE_SIZE];
|
||||
};
|
||||
|
||||
|
||||
class ihipModule_t{
|
||||
public:
|
||||
hsa_executable_t executable;
|
||||
hsa_code_object_t object;
|
||||
std::string fileName;
|
||||
void *ptr;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
class ihipFunction_t{
|
||||
public:
|
||||
ihipFunction_t(const char *name) {
|
||||
@@ -507,9 +528,9 @@ private:
|
||||
|
||||
// The unsigned return is hipMemcpyKind
|
||||
unsigned resolveMemcpyDirection(bool srcInDeviceMem, bool dstInDeviceMem);
|
||||
void resolveHcMemcpyDirection(unsigned hipMemKind,
|
||||
const hc::AmPointerInfo *dstPtrInfo, const hc::AmPointerInfo *srcPtrInfo,
|
||||
hc::hcCommandKind *hcCopyDir,
|
||||
void resolveHcMemcpyDirection(unsigned hipMemKind,
|
||||
const hc::AmPointerInfo *dstPtrInfo, const hc::AmPointerInfo *srcPtrInfo,
|
||||
hc::hcCommandKind *hcCopyDir,
|
||||
ihipCtx_t **copyDevice,
|
||||
bool *forceUnpinnedCopy);
|
||||
|
||||
|
||||
@@ -1037,15 +1037,24 @@ hipError_t hipMemGetAddressRange ( hipDeviceptr_t* pbase, size_t* psize, hipDevi
|
||||
|
||||
|
||||
//TODO: IPC implementaiton:
|
||||
hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr){
|
||||
return hipSuccess;
|
||||
}
|
||||
hipError_t hipIpcCloseMemHandle(void *devPtr){
|
||||
return hipSuccess;
|
||||
}
|
||||
hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle){
|
||||
return hipSuccess;
|
||||
}
|
||||
hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags){
|
||||
return hipSuccess;
|
||||
// HIP_INIT_API ( devPtr, handle.handle , flags);
|
||||
hipError_t hipStatus = hipSuccess;
|
||||
return hipStatus;
|
||||
}
|
||||
|
||||
hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr){
|
||||
HIP_INIT_API ( handle, devPtr);
|
||||
hipError_t hipStatus = hipSuccess;
|
||||
return hipStatus;
|
||||
}
|
||||
|
||||
hipError_t hipIpcCloseMemHandle(void *devPtr){
|
||||
HIP_INIT_API ( devPtr );
|
||||
hipError_t hipStatus = hipSuccess;
|
||||
return hipStatus;
|
||||
}
|
||||
|
||||
// hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle){
|
||||
// return hipSuccess;
|
||||
// }
|
||||
|
||||
Ссылка в новой задаче
Block a user