Enabling hipGetDeviceFlags required in [SWDEV-229170]

Change-Id: I998d37e5847f9651345554bada86df6fce86d1eb


[ROCm/clr commit: 94699a7a6f]
Tento commit je obsažen v:
Sarbojit Sarkar
2020-05-07 03:57:58 -04:00
rodič 090826f5dc
revize 8ea2da75d2
6 změnil soubory, kde provedl 28 přidání a 4 odebrání
+8
Zobrazit soubor
@@ -506,6 +506,14 @@ hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t config);
*/ */
hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig* pConfig); hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig* pConfig);
/**
* @brief Gets the flags set for current device
*
* @param [out] flags
*
* @returns #hipSuccess, #hipErrorInvalidDevice, #hipErrorInvalidValue
*/
hipError_t hipGetDeviceFlags(unsigned *flags);
/** /**
* @brief The bank width of shared memory on current device is set * @brief The bank width of shared memory on current device is set
+4
Zobrazit soubor
@@ -1511,6 +1511,10 @@ inline static hipError_t hipProfilerStart() { return hipCUDAErrorTohipError(cuda
inline static hipError_t hipProfilerStop() { return hipCUDAErrorTohipError(cudaProfilerStop()); } inline static hipError_t hipProfilerStop() { return hipCUDAErrorTohipError(cudaProfilerStop()); }
inline static hipError_t hipGetDeviceFlags(unsigned int* flags) {
return hipCUDAErrorTohipError(cudaGetDeviceFlags(flags));
}
inline static hipError_t hipSetDeviceFlags(unsigned int flags) { inline static hipError_t hipSetDeviceFlags(unsigned int flags) {
return hipCUDAErrorTohipError(cudaSetDeviceFlags(flags)); return hipCUDAErrorTohipError(cudaSetDeviceFlags(flags));
} }
+7 -1
Zobrazit soubor
@@ -471,7 +471,12 @@ hipError_t hipGetDeviceCount ( int* count ) {
} }
hipError_t hipGetDeviceFlags ( unsigned int* flags ) { hipError_t hipGetDeviceFlags ( unsigned int* flags ) {
HIP_RETURN(hipErrorNotSupported); HIP_INIT_API(hipGetDeviceFlags, flags);
if (flags == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
*flags = hip::getCurrentDevice()->getFlags();
HIP_RETURN(hipSuccess);
} }
hipError_t hipIpcGetEventHandle ( hipIpcEventHandle_t* handle, hipEvent_t event ) { hipError_t hipIpcGetEventHandle ( hipIpcEventHandle_t* handle, hipEvent_t event ) {
@@ -531,6 +536,7 @@ hipError_t hipSetDeviceFlags ( unsigned int flags ) {
default: default:
break; break;
} }
hip::getCurrentDevice()->setFlags(flags & hipDeviceScheduleMask);
HIP_RETURN(hipSuccess); HIP_RETURN(hipSuccess);
} }
+1
Zobrazit soubor
@@ -149,6 +149,7 @@ hipPointerGetAttributes
hipProfilerStart hipProfilerStart
hipProfilerStop hipProfilerStop
hipRuntimeGetVersion hipRuntimeGetVersion
hipGetDeviceFlags
hipSetDevice hipSetDevice
hipSetDeviceFlags hipSetDeviceFlags
hipStreamAddCallback hipStreamAddCallback
+1
Zobrazit soubor
@@ -149,6 +149,7 @@ global:
hipProfilerStart; hipProfilerStart;
hipProfilerStop; hipProfilerStop;
hipRuntimeGetVersion; hipRuntimeGetVersion;
hipGetDeviceFlags;
hipSetDevice; hipSetDevice;
hipSetDeviceFlags; hipSetDeviceFlags;
hipStreamAddCallback; hipStreamAddCallback;
+6 -2
Zobrazit soubor
@@ -119,12 +119,14 @@ namespace hip {
int deviceId_; int deviceId_;
/// ROCclr host queue for default streams /// ROCclr host queue for default streams
Stream null_stream_; Stream null_stream_;
//Maintain list of user enabled peers /// Store device flags
unsigned int flags_;
/// Maintain list of user enabled peers
std::list<int> userEnabledPeers; std::list<int> userEnabledPeers;
public: public:
Device(amd::Context* ctx, int devId): Device(amd::Context* ctx, int devId):
context_(ctx), deviceId_(devId), null_stream_(this, amd::CommandQueue::Priority::Normal, 0, true) context_(ctx), deviceId_(devId), null_stream_(this, amd::CommandQueue::Priority::Normal, 0, true), flags_(hipDeviceScheduleSpin)
{ assert(ctx != nullptr); } { assert(ctx != nullptr); }
~Device() {} ~Device() {}
@@ -152,6 +154,8 @@ namespace hip {
return hipErrorPeerAccessNotEnabled; return hipErrorPeerAccessNotEnabled;
} }
} }
unsigned int getFlags() const { return flags_; }
void setFlags(unsigned int flags) { flags_ = flags; }
amd::HostQueue* NullStream(bool skip_alloc = false); amd::HostQueue* NullStream(bool skip_alloc = false);
}; };