Siu Chi Chan
bafd29662c
replace std::vector for kernarg
...
[ROCm/clr commit: 1fb9ab2d44 ]
2019-05-24 17:27:43 -04:00
Siu Chi Chan
304a1e2dbe
move executable_cache into program_state.cpp
...
[ROCm/clr commit: 1a2d332e76 ]
2019-05-24 17:27:25 -04:00
Siu Chi Chan
305eb4239e
remove executables() from program_state
...
[ROCm/clr commit: e2c0122892 ]
2019-05-24 17:27:01 -04:00
Siu Chi Chan
76f535b4ce
migrate program_state logic from header into shared library (phase I) ( #1077 )
...
* Revert "Revert "Use COMgr to read Kernel Args Metadata (#1006 )""
This reverts commit f8d108a815 .
* Revert "Use COMgr to read Kernel Args Metadata (#1006 )"
This reverts commit 10048a5631 .
* Revert "improve program state commentary"
This reverts commit 5233d41c6c .
* Revert "load program state once per agent"
This reverts commit 9cee2c5311 .
* start moving function_names() into the hip shared lib
* start moving code_object_blobs to a new "state" object
* Consolidate various program state related static objects into a
single program_state object
* minor clean up
* move more stuffs from functional_grid_launch into program_state
* debug make_kernarg
* moving lookup for kernargs size_align into program_state
* clean up old code for kernarg size and alignment
* update hip_module to use newer api in program_state
* Create public member functions for program_state
* move most program state functions into shared library
* Pass the data buffer size to load_executable
Otherwise, it can't figure what the data size is
just from the char* (since the data is not really a string)
* turning free functions in program state into members of program_state_impl
* change the free function globals() into a member of program_state_impl
* replace the static mutex used for populating globals
* moving associate_code_object_symbols_with_host_allocation into
program_state_impl
* move load_code_object_and_freeze_executable into program_state_impl
* moving executables and functions_names into program_state_impl
* moving kernels() into program_state_impl
* moving functions() into program_state_impl
* move get_kernargs into program_state_impl
* moving kernel_descriptor into program_state_impl
* moving kernargs_size_align calculation into program_state_impl
* Changing the handle to program_state_impl to a pointer
* moving program_state_impl into a separate inline source file
* fixing/cleaning up some header file includes
* moving member function for kernargs_size_align into program_state.cpp
* moving Kernel_descriptor into program_state.inl
* add a new class to manage agent globals
* moving all agent globals processing functions into agent_globals_impl
* load program state once per agent
re-merging PR991 against other program state changes
* fix per-agent program state member initialization
* cache executables based on elf name, isa, and agent.
This avoids program state reloading executables after a shared library is dlopened.
re-merging PR1057 against other program state changes
* protect executables cache by a global mutex
* return ref to executables cache
* adapt PR#981 Make hipModuleGetGlobal be in HIP runtime
[ROCm/clr commit: 05a1b696da ]
2019-05-12 19:24:03 +05:30
Alex Voicu
45f4ac5023
dlopen() fixes ( #929 )
...
* Initial attempt to switch over to internally linked state.
* Add missing CMake update.
* hipLaunchKernelGGLImpl must be inline as well. Ensure internal linkage.
* Ensure global retrieval uses internally linked state.
* Hide HC in the implementation. Minimise ADL woes.
* Strange software exists, and must be catered to.
* Use a less spammy mechanism for ensuring internal linkage / non-export.
* Remove leftover internal detail.
[ROCm/clr commit: ed48847237 ]
2019-03-06 17:31:44 +05:30
Alex Voicu
47b142ad3b
Ensure that static structures are populated
...
[ROCm/clr commit: 1c815170da ]
2019-01-09 17:21:53 +00:00
Alex Voicu
cfed8191f1
Hook into the creaky lazy-reinit machinery. Try to minimise race-risk.
...
[ROCm/clr commit: 3470692998 ]
2019-01-01 11:01:16 +05:30
Alex Voicu
6e61270569
More blobs, more problems.
...
[ROCm/clr commit: b2f76123b1 ]
2019-01-01 11:01:07 +05:30
Alex Voicu
eebc544c62
Start re-working 731 for 2.0.
...
[ROCm/clr commit: 3e8f198b58 ]
2019-01-01 11:00:57 +05:30
Siu Chi Chan
bda6edc929
Revert "Rely on code object metadat for kernarg arguments alignof and sizeof."
...
This reverts commit 1ec78f6d67 .
[ROCm/clr commit: 4251a70bc0 ]
2018-11-29 11:38:37 -05:00
Siu Chi Chan
b47617dd72
Revert "Handle the very confusing dual encoding of the symbol name."
...
This reverts commit 8599d053b4 .
[ROCm/clr commit: a41bce5163 ]
2018-11-29 11:38:36 -05:00
Siu Chi Chan
9b6b628695
Revert "If we've already seen a __global__ function we do not need to re-parse"
...
This reverts commit 58c5dedc16 .
[ROCm/clr commit: dc36c49212 ]
2018-11-29 11:38:35 -05:00
Siu Chi Chan
44ac74c9db
Revert "Missing handling nullary __global__ functions for mixed arity cases."
...
This reverts commit 5647e0ae35 .
[ROCm/clr commit: c5df445d1f ]
2018-11-29 11:38:31 -05:00
Siu Chi Chan
61785e9d39
Revert "Fix issue in kernarg metadata parsing due to early finalization"
...
This reverts commit 0c610f5890 .
[ROCm/clr commit: adbf0c444b ]
2018-11-29 11:35:00 -05:00
Siu Chi Chan
0c610f5890
Fix issue in kernarg metadata parsing due to early finalization
...
The logic to parse the kernel metadata is unaware that enabling
of early finalization could result in multiple code blobs in a
single .kernel section. This teaches the HIP runtime to handle
that.
Change-Id: I1581b42f0da8b30233d7898014f7468728c1d489
[ROCm/clr commit: ba2b5ff9da ]
2018-11-21 12:09:46 -05:00
Alex Voicu
5647e0ae35
Missing handling nullary __global__ functions for mixed arity cases.
...
[ROCm/clr commit: 1e64813716 ]
2018-11-12 01:51:59 +00:00
Alex Voicu
e3c9869fbe
Merge branch 'master' of https://github.com/ROCm-Developer-Tools/HIP into feature_get_alignment_and_size_from_metadata
...
[ROCm/clr commit: 1c525d7222 ]
2018-11-01 23:17:27 +00:00
Alex Voicu
58c5dedc16
If we've already seen a __global__ function we do not need to re-parse
...
[ROCm/clr commit: 1621deee71 ]
2018-10-30 23:34:27 +00:00
Alex Voicu
8599d053b4
Handle the very confusing dual encoding of the symbol name.
...
[ROCm/clr commit: 1fe33b4738 ]
2018-10-30 01:55:09 +00:00
Alex Voicu
1ec78f6d67
Rely on code object metadat for kernarg arguments alignof and sizeof.
...
[ROCm/clr commit: 299b9d1382 ]
2018-10-28 17:01:00 +00:00
Siu Chi Chan
5d1a265efc
Support more than one bundles in a single .kernel section
...
When compiling with Early Finalization enabled in HCC,
the resulting .kernel section of the host object now may
contain more than one device code bundles. This is to
teach the HIP runtime to correctly extract all the
bundles from the .kernel section.
[ROCm/clr commit: f39873c584 ]
2018-10-18 17:00:27 -04:00
Wen-Heng (Jack) Chung
73fc21f717
Keep the map which tracks GPU kernel symbols to grow monotonically
...
[ROCm/clr commit: e257de95f3 ]
2018-09-26 19:49:02 +00:00
Wen-Heng (Jack) Chung
1e956fcd70
Improve performance of re-initialization logic
...
Keep track of shared libaries already discovered. Do not build HSA executables
for them.
[ROCm/clr commit: 060b3c0bf8 ]
2018-09-26 19:48:56 +00:00
Wen-Heng (Jack) Chung
4e0f0b3e89
HIP program state re-initialization logic
...
This commit is to support kernels dynamically loaded thru means such as
dlopen() after HIP runtime initializes.
[ROCm/clr commit: 319f007bf1 ]
2018-09-26 19:48:47 +00:00
Maneesh Gupta
bb9d95188a
Merge pull request #621 from ROCm-Developer-Tools/disable_startup_loader
...
Disable startup loader by default and guard with env var
[ROCm/clr commit: e10fa70173 ]
2018-08-10 10:18:25 +05:30
sunway513
3621ec1971
resolve a segfault bug when env var not set; remove startup_kernel_loader class
...
[ROCm/clr commit: 7c467220a8 ]
2018-08-09 16:40:26 +00:00
sunway513
e1d72394da
Add more check to ensure the startup loader only be enabled with the env var set to 1
...
[ROCm/clr commit: 7d776ae665 ]
2018-08-04 01:52:27 +00:00
sunway513
ef368c0f43
Add startup loader under HIP_STARTUP_LOADER env var, disable by default
...
[ROCm/clr commit: 9af862d364 ]
2018-08-04 01:48:06 +00:00
Wen-Heng (Jack) Chung
d7b2bab183
Revert "HIP program state re-initialization logic"
...
This reverts commit 865fe01b37 .
[ROCm/clr commit: 1fe7f1be91 ]
2018-08-03 17:03:04 -05:00
Wen-Heng (Jack) Chung
fbf97dddb5
Revert "Improve performance of re-initialization logic"
...
This reverts commit 1d1b402e5b .
[ROCm/clr commit: f6178c2159 ]
2018-08-03 17:02:58 -05:00
Wen-Heng (Jack) Chung
1494fc442f
Revert "Keep the map which tracks GPU kernel symbols to grow monotonically"
...
This reverts commit ca62af218c .
[ROCm/clr commit: 329f3b7a5e ]
2018-08-03 17:02:50 -05:00
Wen-Heng (Jack) Chung
ca62af218c
Keep the map which tracks GPU kernel symbols to grow monotonically
...
[ROCm/clr commit: 8f521edff1 ]
2018-06-18 16:54:18 -05:00
Wen-Heng (Jack) Chung
1d1b402e5b
Improve performance of re-initialization logic
...
Keep track of shared libaries already discovered. Do not build HSA executables
for them.
[ROCm/clr commit: b883ea759d ]
2018-06-15 18:07:33 -05:00
Wen-Heng (Jack) Chung
865fe01b37
HIP program state re-initialization logic
...
This commit is to support kernels dynamically loaded thru means such as
dlopen() after HIP runtime initializes.
[ROCm/clr commit: 04640992dc ]
2018-06-14 15:46:49 +00:00
Alex Voicu
4e6996282d
Add support for the hipFuncGetAttributes interface.
...
[ROCm/clr commit: bf9529aaa8 ]
2018-05-11 03:35:10 +01:00
Maneesh Gupta
46ddefedee
Apply .clangformat to all repo source files
...
Change-Id: I7e79c6058f0303f9a98911e3b7dd2e8596079344
[ROCm/clr commit: 9e47fccc89 ]
2018-03-12 11:29:03 +05:30
Alex Voicu
4e8e090839
Merge branch 'master' of https://github.com/ROCm-Developer-Tools/HIP into feature_purge_genco
...
[ROCm/clr commit: 1563d53c92 ]
2018-02-22 12:08:52 +00:00
Siu Chi Chan
9fddf100b7
make HIP to load the GPU objects and to setup the function symbol map on startup
...
[ROCm/clr commit: 0ca9591e55 ]
2018-02-18 14:26:44 -05:00
Alex Voicu
eab8624938
Re-sync with upstream.
...
[ROCm/clr commit: a704bd8b44 ]
2018-02-12 20:20:24 +00:00
Rahul Garg
f15543d5cf
Fixed host allocated globals address lookup for host usage
...
Fixed texture driver APIs failure
[ROCm/clr commit: b8c23f979b ]
2018-01-30 18:06:31 +05:30
Alex Voicu
aa48cc7b55
This introduces LipoProteinLipase (lpl), a simple tool for creating fat binaries. It represents a direct replacement of the creaky hccgenco.sh script, which had various issues. The format it uses is that of a code object bundle, generated by the Clang Offload Bundler. The output is always suffixed with the ".adipose" extension. It is shared with HCC. The hipcc script and associated tests are modified to use lpl. Help can be obtained by invoking lpl --help. A more computer-sciency / corporate friendly name is likely to be beneficial, which is a reason for choosing easily searchable/replaceable names such as lpl or adipose.
...
[ROCm/clr commit: 4e0739c68a ]
2017-12-08 04:22:57 +00:00
Alex Voicu
37e40fcd40
This is primarily intended as an additional cleanup of the module functionality, in the aftermath of adopting module based dispatch. The main effort was associated with refactoring the questionable ihipModuleGetSymbol. It was quaintly written and misleading, in that it had little to do with getting symbols, and was exactly retrieving a kernel object. Error handling is modified so as to reduce branching depth. Functions which serve as interfaces to the HSA RT are moved in a separate helper header. Code object readers are properly deleted. Some leftover dead functionality pertaining to associating namespace scope variables with their allocated memory is removed. Executable loading is changed to use a string which holds the ELF image of the code object being loaded, thus avoiding some corner cases where using a istream would fail.
...
[ROCm/clr commit: e186bd9533 ]
2017-12-03 23:09:06 +00:00
Alex Voicu
76336d46b4
Fix legacy mode detection of the address of an agent allocated variable. In this mode, there exist two executables per each code object, one created by HCC and one created by HIP. Since we dispatch through HCC in legacy mode, we should obtain the address for an agent allocated variable from the latter's executable. Also add two omitted validity checks, whose absence could lead to segfaults when the current process had no .kernel section and / or when an invalid or empty blob was extracted from the latter.
...
[ROCm/clr commit: 33bb425013 ]
2017-11-30 03:29:04 +00:00
Alex Voicu
914acbe88f
Re-sync with upstream and re-factor platform global management for texture references.
...
[ROCm/clr commit: 6a0efb7ed2 ]
2017-11-28 19:15:29 +00:00
Alex Voicu
31deac0768
This corrects how addresses are formed for symbols which reside in shared objects. For this case, the .value component of an ELF symbol holds the offset from the base VA where the shared object was loaded. Thus, to correctly obtain the VA of the object refered by the symbol, we must add the offset to the VA where the shared object is loaded. We were already doing this correctly for symbols denoting functions, but we were incorrect for those denoting objects.
...
[ROCm/clr commit: fb1021cc0a ]
2017-11-21 13:15:13 +00:00
Alex Voicu
1366b2d5ae
Refactor the __device__ versions of memset and memcpy to be less awkward i.e. not return nullptr as opposed to the destination pointer (it can only be assumed it was done for maximum confusion) and actually unroll as they claim to. Change all of the {to, from}Symbol functions to use hipModuleGetGlobal, as opposed to hc::accelerator::get_symbol_address which is no longer valid with module based dispatch.
...
[ROCm/clr commit: f8c1c1b38e ]
2017-11-21 02:40:34 +00:00
Alex Voicu
98ea26e613
Clean-up some remaining noise in program_state.cpp.
...
[ROCm/clr commit: 24f8a93ff7 ]
2017-11-20 22:41:46 +00:00
Alex Voicu
840895525a
Correctly deal with functions from shared objects, wherein the program visible VA == so_base_va + st_value(function_symbol). Remove quaint usage of pfe for hipMemset (which is actually fill_n).
...
[ROCm/clr commit: 4693c5e56c ]
2017-11-01 22:33:13 +00:00
Alex Voicu
b738633bcb
This switches HIP from its currently convoluted macro + pfe based dispatch mechanism to a more natural one partially based on the existing module API. The basic idea is that HCC will always correctly emit __global__ functions: as empty-bodied stubs, on host, and as kernels, on device. It then becomes trivial to obtain the mangled name on host, at dispatch, from the function's address, and then to use the mangled name to retrieve the kernel. This should address all problems stemming from serialisation, dubious mismatches due to the manufactured functor, macro-isms et al. It also immediately enables support for generalised globals as a consequence of that being available in the module API. Finally, it will make debug much easier, since the actual names of the __global__ functions will automatically be used in traces etc. One detail is that due to how dispatch works now (hipLaunchKernel and hipLaunchKernelGGL are themselves variadic function templates which deduce the function type of the callee), in certain cases it may be necesssary to insert explicit casts to ensure that the variadic argument list selects a viable overload - this can be observed in some unit tests. Eventually we may be able to remove this limitation, but for now it does not appear terribly onerous. The code is not extremely HIPpie, nor is it fully optimised, but rather is intended as a starting point for the HIP team to make its own.
...
[ROCm/clr commit: 28f87f7d2e ]
2017-11-01 15:09:59 +00:00