Files
rocm-systems/rocclr/runtime/device/comgrctx.cpp
T
foreman 3f6e18bf6b P4 to Git Change 2024454 by axie@axie-hip-rocm on 2019/11/04 14:38:31
SWDEV-198863 - Options for hip-clang-vdi path to provide the chicken bits, or functional equivalents to HCC_DB (phase 1)

	1. The log macros is turned off for release build.  So log functions has zero impact to release build.
	2. The log macros have level, mask, condition control. So we can have more control to avoid log flooding.

	I also adjusted some existing log to use new log functions.
	1. To excercise and test the new log functions.
	2. To improve performance slightly.
	3. The change is mainly for HIP-ROCM, we can move more in next phases for PAL or ORCA.
	4. I make these log feature unavailable for release build. We can revert to old log functions for release build in a case by case method.

	Tests:
	1. http://ocltc.amd.com:8111/viewModification.html?modId=128289&personal=true&tab=vcsModificationBuilds
	http://ocltc.amd.com:8111/viewModification.html?modId=128358&personal=true&tab=vcsModificationBuilds

	2. release build, run hip program, there is no log
	3. fastdebug build, run hip program,
	export LOG_LEVEL=3
	export GPU_LOG_MASK=4294967295
	There was a lot of logs.

	4. fastdebug build, run hip program,
	export LOG_LEVEL=2
	export GPU_LOG_MASK=4294967295
	There was no logs.

	5. fastdebug build, run hip program,
	export LOG_LEVEL=3
	export GPU_LOG_MASK=4294967294
	There was much less logs.

	6. fastdebug build, run hip program,
	export LOG_LEVEL=3
	export GPU_LOG_MASK=47102
	There was even much less logs. The logs was expected according to the mask.

	7. Tested step 2 to 6 similarily in Windows and Linux

	ReviewBoard: http://ocltc.amd.com/reviews/r/18215

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#46 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_memory.cpp#82 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_stream.cpp#26 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hiprtc_internal.hpp#2 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/comgrctx.cpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#68 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#137 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#91 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#100 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#32 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/runtime.cpp#40 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/debug.hpp#10 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#323 edit
2019-11-04 14:44:59 -05:00

77 γραμμές
3.0 KiB
C++

//
// Copyright (c) 2008 Advanced Micro Devices, Inc. All rights reserved.
//
#if defined(USE_COMGR_LIBRARY)
#include "os/os.hpp"
#include "utils/flags.hpp"
#include "comgrctx.hpp"
namespace amd {
std::once_flag Comgr::initialized;
ComgrEntryPoints Comgr::cep_;
bool Comgr::is_ready_ = false;
bool Comgr::LoadLib() {
#if defined(COMGR_DYN_DLL)
ClPrint(amd::LOG_INFO, amd::LOG_CODE, "Loading COMGR library.");
static const char* ComgrLibName =
LP64_SWITCH(WINDOWS_SWITCH("amd_comgr32.dll", "libamd_comgr32.so"),
WINDOWS_SWITCH("amd_comgr.dll", "libamd_comgr.so"));
cep_.handle = Os::loadLibrary(ComgrLibName);
if (nullptr == cep_.handle) {
return false;
}
#endif
GET_COMGR_SYMBOL(amd_comgr_get_version)
GET_COMGR_SYMBOL(amd_comgr_status_string)
GET_COMGR_SYMBOL(amd_comgr_get_isa_count)
GET_COMGR_SYMBOL(amd_comgr_get_isa_name)
GET_COMGR_SYMBOL(amd_comgr_get_isa_metadata)
GET_COMGR_SYMBOL(amd_comgr_create_data)
GET_COMGR_SYMBOL(amd_comgr_release_data)
GET_COMGR_SYMBOL(amd_comgr_get_data_kind)
GET_COMGR_SYMBOL(amd_comgr_set_data)
GET_COMGR_SYMBOL(amd_comgr_set_data_name)
GET_COMGR_SYMBOL(amd_comgr_get_data)
GET_COMGR_SYMBOL(amd_comgr_get_data_name)
GET_COMGR_SYMBOL(amd_comgr_get_data_isa_name)
GET_COMGR_SYMBOL(amd_comgr_get_data_metadata)
GET_COMGR_SYMBOL(amd_comgr_destroy_metadata)
GET_COMGR_SYMBOL(amd_comgr_create_data_set)
GET_COMGR_SYMBOL(amd_comgr_destroy_data_set)
GET_COMGR_SYMBOL(amd_comgr_data_set_add)
GET_COMGR_SYMBOL(amd_comgr_data_set_remove)
GET_COMGR_SYMBOL(amd_comgr_action_data_count)
GET_COMGR_SYMBOL(amd_comgr_action_data_get_data)
GET_COMGR_SYMBOL(amd_comgr_create_action_info)
GET_COMGR_SYMBOL(amd_comgr_destroy_action_info)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_isa_name)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_isa_name)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_language)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_language)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_options)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_options)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_option_list)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_option_list_count)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_option_list_item)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_working_directory_path)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_working_directory_path)
GET_COMGR_SYMBOL(amd_comgr_action_info_set_logging)
GET_COMGR_SYMBOL(amd_comgr_action_info_get_logging)
GET_COMGR_SYMBOL(amd_comgr_do_action)
GET_COMGR_SYMBOL(amd_comgr_get_metadata_kind)
GET_COMGR_SYMBOL(amd_comgr_get_metadata_string)
GET_COMGR_SYMBOL(amd_comgr_get_metadata_map_size)
GET_COMGR_SYMBOL(amd_comgr_iterate_map_metadata)
GET_COMGR_SYMBOL(amd_comgr_metadata_lookup)
GET_COMGR_SYMBOL(amd_comgr_get_metadata_list_size)
GET_COMGR_SYMBOL(amd_comgr_index_list_metadata)
GET_COMGR_SYMBOL(amd_comgr_iterate_symbols)
GET_COMGR_SYMBOL(amd_comgr_symbol_lookup)
GET_COMGR_SYMBOL(amd_comgr_symbol_get_info)
is_ready_ = true;
return true;
}
}
#endif