Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Various build fixes warning proposal. #20

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/hip_device_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* properties) {
*device = 0;
cl_uint maxMatchedCount = 0;
int count = 0;
ihipDeviceGetCount(&count);
(void)ihipDeviceGetCount(&count);

for (cl_int i = 0; i< count; ++i) {
hipDeviceProp_t currentProp = {0};
Expand Down Expand Up @@ -145,7 +145,7 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
}

int count = 0;
ihipDeviceGetCount(&count);
(void)ihipDeviceGetCount(&count);
if (device < 0 || device >= count) {
HIP_RETURN(hipErrorInvalidDevice);
}
Expand Down Expand Up @@ -344,12 +344,12 @@ hipError_t hipDeviceGetByPCIBusId(int* device, const char*pciBusIdstr) {
reinterpret_cast<unsigned int*>(&pciBusID),
reinterpret_cast<unsigned int*>(&pciDeviceID)) == 0x3) {
int count = 0;
ihipDeviceGetCount(&count);
(void)ihipDeviceGetCount(&count);
for (cl_int i = 0; i < count; i++) {
hipDevice_t dev;
ihipDeviceGet(&dev, i);
hipDeviceProp_t prop;
ihipGetDeviceProperties(&prop, dev);
(void)ihipDeviceGet(&dev, i);
(void)ihipGetDeviceProperties(&prop, dev);

if ((pciBusID == prop.pciBusID) && (pciDomainID == prop.pciDomainID)
&& (pciDeviceID == prop.pciDeviceID)) {
Expand Down Expand Up @@ -386,8 +386,8 @@ hipError_t hipDeviceGetLimit ( size_t* pValue, hipLimit_t limit ) {
HIP_RETURN(hipErrorInvalidValue);
}
if(limit == hipLimitMallocHeapSize) {
hipDeviceProp_t prop;
ihipGetDeviceProperties(&prop, ihipGetDevice());
hipDeviceProp_t prop = {0};
(void)ihipGetDeviceProperties(&prop, ihipGetDevice());

*pValue = prop.totalGlobalMem;
HIP_RETURN(hipSuccess);
Expand All @@ -401,7 +401,7 @@ hipError_t hipDeviceGetPCIBusId ( char* pciBusId, int len, int device ) {
HIP_INIT_API(hipDeviceGetPCIBusId, (void*)pciBusId, len, device);

int count;
ihipDeviceGetCount(&count);
(void)ihipDeviceGetCount(&count);
if (device < 0 || device >= count) {
HIP_RETURN(hipErrorInvalidDevice);
}
Expand All @@ -411,7 +411,7 @@ hipError_t hipDeviceGetPCIBusId ( char* pciBusId, int len, int device ) {
}

hipDeviceProp_t prop;
ihipGetDeviceProperties(&prop, device);
(void)ihipGetDeviceProperties(&prop, device);

snprintf (pciBusId, len, "%04x:%02x:%02x.0",
prop.pciDomainID,
Expand Down
25 changes: 14 additions & 11 deletions src/hip_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extern "C" void __hipRegisterFunction(
}() };

hip::Function* func = new hip::Function(std::string(deviceName), modules);
PlatformState::instance().registerStatFunction(hostFunction, func);
(void)PlatformState::instance().registerStatFunction(hostFunction, func);

if (!enable_deferred_loading) {
HIP_INIT_VOID();
Expand Down Expand Up @@ -130,7 +130,7 @@ extern "C" void __hipRegisterVar(
int global) // Unknown, always 0
{
hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Variable, size, 0, 0, modules);
PlatformState::instance().registerStatGlobalVar(var, var_ptr);
(void)PlatformState::instance().registerStatGlobalVar(var, var_ptr);
}

extern "C" void __hipRegisterSurface(hip::FatBinaryInfo** modules, // The device modules containing code object
Expand All @@ -139,7 +139,7 @@ extern "C" void __hipRegisterSurface(hip::FatBinaryInfo** modules, // The d
char* deviceVar, // Variable name in device code
int type, int ext) {
hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Surface, sizeof(surfaceReference), 0, 0, modules);
PlatformState::instance().registerStatGlobalVar(var, var_ptr);
(void)PlatformState::instance().registerStatGlobalVar(var, var_ptr);
}

extern "C" void __hipRegisterManagedVar(void *hipModule, // Pointer to hip module returned from __hipRegisterFatbinary
Expand All @@ -154,7 +154,10 @@ extern "C" void __hipRegisterManagedVar(void *hipModule, // Pointer to hip mod
if( status == hipSuccess) {
amd::HostQueue* queue = hip::getNullStream();
if(queue != nullptr) {
ihipMemcpy(*pointer, init_value, size, hipMemcpyHostToDevice, *queue);
status = ihipMemcpy(*pointer, init_value, size, hipMemcpyHostToDevice, *queue);
if ( status != hipSuccess) {
guarantee(false, "Error during copy on the managed memory!");
}
} else {
ClPrint(amd::LOG_ERROR, amd::LOG_API, "Host Queue is NULL");
}
Expand All @@ -163,7 +166,7 @@ extern "C" void __hipRegisterManagedVar(void *hipModule, // Pointer to hip mod
}
hip::Var* var_ptr = new hip::Var(std::string(name), hip::Var::DeviceVarKind::DVK_Managed, pointer,
size, align, reinterpret_cast<hip::FatBinaryInfo**>(hipModule));
PlatformState::instance().registerStatManagedVar(var_ptr);
(void)PlatformState::instance().registerStatManagedVar(var_ptr);
}

extern "C" void __hipRegisterTexture(hip::FatBinaryInfo** modules, // The device modules containing code object
Expand All @@ -172,12 +175,12 @@ extern "C" void __hipRegisterTexture(hip::FatBinaryInfo** modules, // The d
char* deviceVar, // Variable name in device code
int type, int norm, int ext) {
hip::Var* var_ptr = new hip::Var(std::string(hostVar), hip::Var::DeviceVarKind::DVK_Texture, sizeof(textureReference), 0, 0, modules);
PlatformState::instance().registerStatGlobalVar(var, var_ptr);
(void)PlatformState::instance().registerStatGlobalVar(var, var_ptr);
}

extern "C" void __hipUnregisterFatBinary(hip::FatBinaryInfo** modules)
{
PlatformState::instance().removeFatBinary(modules);
(void)PlatformState::instance().removeFatBinary(modules);
}

extern "C" hipError_t hipConfigureCall(
Expand Down Expand Up @@ -608,7 +611,7 @@ void hipLaunchKernelGGLImpl(
LogPrintfError("Cannot find the static function: 0x%x", function_address);
}

hipModuleLaunchKernel(func,
(void)hipModuleLaunchKernel(func,
numBlocks.x, numBlocks.y, numBlocks.z,
dimBlocks.x, dimBlocks.y, dimBlocks.z,
sharedMemBytes, stream, nullptr, kernarg);
Expand All @@ -624,7 +627,7 @@ void hipLaunchCooperativeKernelGGLImpl(
{
HIP_INIT_VOID();

hipLaunchCooperativeKernel(reinterpret_cast<void*>(function_address),
(void)hipLaunchCooperativeKernel(reinterpret_cast<void*>(function_address),
numBlocks, dimBlocks, kernarg, sharedMemBytes, stream);
}

Expand Down Expand Up @@ -730,7 +733,7 @@ void PlatformState::init()
}
initialized_ = true;
for (auto& it : statCO_.modules_) {
digestFatBinary(it.first, it.second);
(void)digestFatBinary(it.first, it.second);
}
for (auto &it : statCO_.vars_) {
it.second->resize_dVar(g_devices.size());
Expand Down Expand Up @@ -819,7 +822,7 @@ hipError_t PlatformState::getDynGlobalVar(const char* hostVar, hipModule_t hmod,
return hipErrorNotFound;
}
*dev_ptr = nullptr;
it->second->getManagedVarPointer(hostVar, dev_ptr, size_ptr);
(void)it->second->getManagedVarPointer(hostVar, dev_ptr, size_ptr);
// if dev_ptr is nullptr, hostvar is not in managed variable list
if (*dev_ptr == nullptr) {
hip::DeviceVar* dvar = nullptr;
Expand Down
7 changes: 7 additions & 0 deletions src/hip_prof_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
#include <mutex>

#if USE_PROF_API
#include <GL/gl.h>
#include <GL/glext.h>

#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <EGL/eglplatform.h>

#include "hip/amd_detail/hip_prof_str.h"
#include "platform/prof_protocol.h"

Expand Down
6 changes: 3 additions & 3 deletions src/hip_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ Stream::~Stream() {
hipError_t Stream::EndCapture() {
for (auto event : captureEvents_) {
hip::Event* e = reinterpret_cast<hip::Event*>(event);
e->EndCapture();
(void)e->EndCapture();
}
for (auto stream : parallelCaptureStreams_) {
hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
s->EndCapture();
(void)s->EndCapture();
}
captureStatus_ = hipStreamCaptureStatusNone;
pCaptureGraph_ = nullptr;
Expand Down Expand Up @@ -307,7 +307,7 @@ class stream_per_thread {
// There is a scenario where hipResetDevice destroys stream per thread
// hence isValid check is required to make sure only valid stream is used
if (m_stream == nullptr || !hip::isValid(m_stream)) {
ihipStreamCreate(&m_stream, hipStreamDefault, hip::Stream::Priority::Normal);
(void)ihipStreamCreate(&m_stream, hipStreamDefault, hip::Stream::Priority::Normal);
}
return m_stream;
}
Expand Down
10 changes: 3 additions & 7 deletions src/hip_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ hipError_t ihipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject,
image = as_amd(memObj)->asImage();

void* surfObjectBuffer = nullptr;
ihipMalloc(&surfObjectBuffer, sizeof(__hip_surface), CL_MEM_SVM_FINE_GRAIN_BUFFER);
(void)ihipMalloc(&surfObjectBuffer, sizeof(__hip_surface), CL_MEM_SVM_FINE_GRAIN_BUFFER);
if (surfObjectBuffer == nullptr) {
return hipErrorOutOfMemory;
}
*pSurfObject = new (surfObjectBuffer) __hip_surface{image, *pResDesc};
pSurfObject = reinterpret_cast<hipSurfaceObject_t *>(new (surfObjectBuffer) __hip_surface{image, *pResDesc});

return hipSuccess;
}
Expand All @@ -83,11 +83,7 @@ hipError_t hipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject,
hipError_t ihipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) {
HIP_INIT_API(hipDestroySurfaceObject, surfaceObject);

if (surfaceObject == nullptr) {
return hipSuccess;
}

return ihipFree(surfaceObject);
return ihipFree(&surfaceObject);
}

hipError_t hipDestroySurfaceObject(hipSurfaceObject_t surfaceObject) {
Expand Down
2 changes: 1 addition & 1 deletion src/hip_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ hipError_t ihipCreateTextureObject(hipTextureObject_t* pTexObject,
}

void *texObjectBuffer = nullptr;
ihipMalloc(&texObjectBuffer, sizeof(__hip_texture), CL_MEM_SVM_FINE_GRAIN_BUFFER);
(void)ihipMalloc(&texObjectBuffer, sizeof(__hip_texture), CL_MEM_SVM_FINE_GRAIN_BUFFER);
if (texObjectBuffer == nullptr) {
return hipErrorOutOfMemory;
}
Expand Down