rocprofiler-sdk/cxx/serialization.hpp Source File

rocprofiler-sdk/cxx/serialization.hpp Source File#

Rocprofiler SDK Developer API: rocprofiler-sdk/cxx/serialization.hpp Source File
Rocprofiler SDK Developer API 0.5.0
ROCm Profiling API and tools
serialization.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
4//
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in all
13// copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22//
23
24#pragma once
25
29#include <rocprofiler-sdk/fwd.h>
33
34#include <cereal/archives/binary.hpp>
35#include <cereal/archives/json.hpp>
36#include <cereal/archives/portable_binary.hpp>
37#include <cereal/cereal.hpp>
38#include <cereal/types/array.hpp>
39#include <cereal/types/atomic.hpp>
40#include <cereal/types/bitset.hpp>
41#include <cereal/types/chrono.hpp>
42#include <cereal/types/common.hpp>
43#include <cereal/types/complex.hpp>
44#include <cereal/types/deque.hpp>
45#include <cereal/types/functional.hpp>
46#include <cereal/types/list.hpp>
47#include <cereal/types/map.hpp>
48#include <cereal/types/optional.hpp>
49#include <cereal/types/queue.hpp>
50#include <cereal/types/set.hpp>
51#include <cereal/types/stack.hpp>
52#include <cereal/types/string.hpp>
53#include <cereal/types/tuple.hpp>
54#include <cereal/types/unordered_map.hpp>
55#include <cereal/types/unordered_set.hpp>
56#include <cereal/types/utility.hpp>
57#include <cereal/types/variant.hpp>
58#include <cereal/types/vector.hpp>
59
60#include <string>
61#include <string_view>
62#include <vector>
63
64#define ROCP_SDK_SAVE_DATA_FIELD(FIELD) ar(make_nvp(#FIELD, data.FIELD))
65#define ROCP_SDK_SAVE_DATA_VALUE(NAME, VALUE) ar(make_nvp(NAME, data.VALUE))
66#define ROCP_SDK_SAVE_DATA_CSTR(FIELD) \
67 ar(make_nvp(#FIELD, std::string{data.FIELD ? data.FIELD : ""}))
68#define ROCP_SDK_SAVE_DATA_BITFIELD(NAME, VALUE) \
69 { \
70 auto _val = data.VALUE; \
71 ar(make_nvp(NAME, _val)); \
72 }
73
74#if !defined(ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN)
75# define ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN \
76 namespace cereal \
77 {
78#endif
79
80#if !defined(ROCPROFILER_SDK_CEREAL_NAMESPACE_END)
81# define ROCPROFILER_SDK_CEREAL_NAMESPACE_END } // namespace cereal
82#endif
83
85
86template <typename ArchiveT>
87void
88save(ArchiveT& ar, rocprofiler_context_id_t data)
89{
91}
92
93template <typename ArchiveT>
94void
95save(ArchiveT& ar, rocprofiler_agent_id_t data)
96{
98}
99
100template <typename ArchiveT>
101void
102save(ArchiveT& ar, hsa_agent_t data)
103{
105}
106
107template <typename ArchiveT>
108void
109save(ArchiveT& ar, rocprofiler_queue_id_t data)
110{
112}
113
114template <typename ArchiveT>
115void
117{
119}
120
121template <typename ArchiveT>
122void
124{
125 ROCP_SDK_SAVE_DATA_FIELD(internal);
126 ROCP_SDK_SAVE_DATA_VALUE("external", external.value);
127}
128
129template <typename ArchiveT>
130void
137
138template <typename ArchiveT>
139void
141{
143 ROCP_SDK_SAVE_DATA_FIELD(code_object_id);
144 ROCP_SDK_SAVE_DATA_FIELD(rocp_agent);
145 ROCP_SDK_SAVE_DATA_FIELD(hsa_agent);
147 ROCP_SDK_SAVE_DATA_FIELD(load_base);
148 ROCP_SDK_SAVE_DATA_FIELD(load_size);
149 ROCP_SDK_SAVE_DATA_FIELD(load_delta);
150 ROCP_SDK_SAVE_DATA_FIELD(storage_type);
152 {
153 ROCP_SDK_SAVE_DATA_FIELD(storage_file);
154 }
156 {
157 ROCP_SDK_SAVE_DATA_FIELD(memory_base);
158 ROCP_SDK_SAVE_DATA_FIELD(memory_size);
159 }
160}
161
162template <typename ArchiveT>
163void
165{
167 ROCP_SDK_SAVE_DATA_FIELD(kernel_id);
168 ROCP_SDK_SAVE_DATA_FIELD(code_object_id);
169 ROCP_SDK_SAVE_DATA_CSTR(kernel_name);
170 ROCP_SDK_SAVE_DATA_FIELD(kernel_object);
171 ROCP_SDK_SAVE_DATA_FIELD(kernarg_segment_size);
172 ROCP_SDK_SAVE_DATA_FIELD(kernarg_segment_alignment);
173 ROCP_SDK_SAVE_DATA_FIELD(group_segment_size);
174 ROCP_SDK_SAVE_DATA_FIELD(private_segment_size);
175}
176
177template <typename ArchiveT>
178void
180{
181 ROCP_SDK_SAVE_DATA_FIELD(uint64_t_retval);
182}
183
184template <typename ArchiveT>
185void
186save(ArchiveT& ar, const hsa_queue_t& data)
187{
188 ar(make_nvp("queue_id", data.id));
189}
190
191template <typename ArchiveT>
192void
193save(ArchiveT& ar, hsa_amd_event_scratch_alloc_start_t data)
194{
195 ar(make_nvp("queue_id", *data.queue));
196 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
197}
198
199template <typename ArchiveT>
200void
201save(ArchiveT& ar, hsa_amd_event_scratch_alloc_end_t data)
202{
203 ar(make_nvp("queue_id", *data.queue));
204 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
206 ROCP_SDK_SAVE_DATA_FIELD(num_slots);
208}
209
210template <typename ArchiveT>
211void
212save(ArchiveT& ar, hsa_amd_event_scratch_free_start_t data)
213{
214 ar(make_nvp("queue_id", *data.queue));
215}
216
217template <typename ArchiveT>
218void
219save(ArchiveT& ar, hsa_amd_event_scratch_free_end_t data)
220{
221 ar(make_nvp("queue_id", *data.queue));
223}
224
225template <typename ArchiveT>
226void
227save(ArchiveT& ar, hsa_amd_event_scratch_async_reclaim_start_t data)
228{
229 ar(make_nvp("queue_id", *data.queue));
230}
231
232template <typename ArchiveT>
233void
234save(ArchiveT& ar, hsa_amd_event_scratch_async_reclaim_end_t data)
235{
236 ar(make_nvp("queue_id", *data.queue));
238}
239
240template <typename ArchiveT>
241void
243{
244 ROCP_SDK_SAVE_DATA_FIELD(int64_t_retval);
245}
246
247template <typename ArchiveT>
248void
250{
252 // ROCP_SDK_SAVE_DATA_FIELD(args);
254}
255
256template <typename ArchiveT>
257void
259{
261 // ROCP_SDK_SAVE_DATA_FIELD(args);
263}
264
265template <typename ArchiveT>
266void
268{
269 ROCP_SDK_SAVE_DATA_FIELD(hipError_t_retval);
270}
271
272template <typename ArchiveT>
273void
275{
277 // ROCP_SDK_SAVE_DATA_FIELD(args);
279}
280
281template <typename ArchiveT>
282void
291
292template <typename ArchiveT>
293void
295{
297 ROCP_SDK_SAVE_DATA_FIELD(agent_id);
298 ROCP_SDK_SAVE_DATA_FIELD(queue_id);
299 ROCP_SDK_SAVE_DATA_FIELD(kernel_id);
300 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
301 ROCP_SDK_SAVE_DATA_FIELD(private_segment_size);
302 ROCP_SDK_SAVE_DATA_FIELD(group_segment_size);
303 ROCP_SDK_SAVE_DATA_FIELD(workgroup_size);
304 ROCP_SDK_SAVE_DATA_FIELD(group_segment_size);
305 ROCP_SDK_SAVE_DATA_FIELD(grid_size);
306}
307
308template <typename ArchiveT>
309void
311{
313 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
314 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
315 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
316}
317
318template <typename ArchiveT>
319void
321{
323 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
324 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
325 ROCP_SDK_SAVE_DATA_FIELD(dst_agent_id);
326 ROCP_SDK_SAVE_DATA_FIELD(src_agent_id);
328}
329
330template <typename ArchiveT>
331void
333{
335 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
336 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
337 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
338 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
339}
340
341template <typename ArchiveT>
342void
344{
346 ROCP_SDK_SAVE_DATA_FIELD(num_records);
347 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
348 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
349 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
350 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
351}
352
353template <typename ArchiveT>
354void
356{
357 ROCP_SDK_SAVE_DATA_FIELD(context_id);
358 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
360 ROCP_SDK_SAVE_DATA_FIELD(operation);
361 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
363}
364
365template <typename ArchiveT, typename Tp>
366void
367save_buffer_tracing_api_record(ArchiveT& ar, Tp data)
368{
371 ROCP_SDK_SAVE_DATA_FIELD(operation);
372 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
373 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
374 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
375 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
376}
377
378template <typename ArchiveT>
379void
384
385template <typename ArchiveT>
386void
388{
390 ROCP_SDK_SAVE_DATA_FIELD(counter_value);
391 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
392}
393
394template <typename ArchiveT>
395void
400
401template <typename ArchiveT>
402void
407
408template <typename ArchiveT>
409void
411{
414 ROCP_SDK_SAVE_DATA_FIELD(operation);
415 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
416 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
417 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
418 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
419 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
420}
421
422template <typename ArchiveT>
423void
425{
428 ROCP_SDK_SAVE_DATA_FIELD(operation);
429 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
430 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
431 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
432 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
433 ROCP_SDK_SAVE_DATA_FIELD(dst_agent_id);
434 ROCP_SDK_SAVE_DATA_FIELD(src_agent_id);
436}
437
438template <typename ArchiveT>
439void
441{
444 ROCP_SDK_SAVE_DATA_FIELD(operation);
445 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
446 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
448
449 switch(data.operation)
450 {
452 {
453 ar(make_nvp("page_fault", data.page_fault));
454 break;
455 }
457 {
458 ar(make_nvp("page_migrate", data.page_migrate));
459 break;
460 }
462 {
463 ar(make_nvp("queue_suspend", data.queue_suspend));
464 break;
465 }
467 {
468 ar(make_nvp("unmap_from_gpu", data.unmap_from_gpu));
469 break;
470 }
473 {
474 throw std::runtime_error{"unsupported page migration operation type"};
475 break;
476 }
477 }
478}
479
480template <typename ArchiveT>
481void
489
490template <typename ArchiveT>
491void
493{
494 ROCP_SDK_SAVE_DATA_FIELD(start_addr);
495 ROCP_SDK_SAVE_DATA_FIELD(end_addr);
496 ROCP_SDK_SAVE_DATA_FIELD(from_node);
498 ROCP_SDK_SAVE_DATA_FIELD(prefetch_node);
499 ROCP_SDK_SAVE_DATA_FIELD(preferred_node);
501}
502
503template <typename ArchiveT>
504void
511
512template <typename ArchiveT>
513void
521
522template <typename ArchiveT>
523void
525{
528 ROCP_SDK_SAVE_DATA_FIELD(operation);
529 ROCP_SDK_SAVE_DATA_FIELD(agent_id);
530 ROCP_SDK_SAVE_DATA_FIELD(queue_id);
531 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
532 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
533 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
534 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
536}
537
538template <typename ArchiveT>
539void
547
548template <typename ArchiveT>
549void
550save(ArchiveT& ar, HsaCacheType data)
551{
552 ROCP_SDK_SAVE_DATA_BITFIELD("Data", ui32.Data);
553 ROCP_SDK_SAVE_DATA_BITFIELD("Instruction", ui32.Instruction);
554 ROCP_SDK_SAVE_DATA_BITFIELD("CPU", ui32.CPU);
555 ROCP_SDK_SAVE_DATA_BITFIELD("HSACU", ui32.HSACU);
556}
557
558template <typename ArchiveT>
559void
560save(ArchiveT& ar, HSA_LINKPROPERTY data)
561{
562 ROCP_SDK_SAVE_DATA_BITFIELD("Override", ui32.Override);
563 ROCP_SDK_SAVE_DATA_BITFIELD("NonCoherent", ui32.NonCoherent);
564 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics32bit", ui32.NoAtomics32bit);
565 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics64bit", ui32.NoAtomics64bit);
566 ROCP_SDK_SAVE_DATA_BITFIELD("NoPeerToPeerDMA", ui32.NoPeerToPeerDMA);
567}
568
569template <typename ArchiveT>
570void
571save(ArchiveT& ar, HSA_CAPABILITY data)
572{
573 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
574 ROCP_SDK_SAVE_DATA_BITFIELD("HSAMMUPresent", ui32.HSAMMUPresent);
575 ROCP_SDK_SAVE_DATA_BITFIELD("SharedWithGraphics", ui32.SharedWithGraphics);
576 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSizePowerOfTwo", ui32.QueueSizePowerOfTwo);
577 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSize32bit", ui32.QueueSize32bit);
578 ROCP_SDK_SAVE_DATA_BITFIELD("QueueIdleEvent", ui32.QueueIdleEvent);
579 ROCP_SDK_SAVE_DATA_BITFIELD("VALimit", ui32.VALimit);
580 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsSupported", ui32.WatchPointsSupported);
581 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsTotalBits", ui32.WatchPointsTotalBits);
582 ROCP_SDK_SAVE_DATA_BITFIELD("DoorbellType", ui32.DoorbellType);
583 ROCP_SDK_SAVE_DATA_BITFIELD("AQLQueueDoubleMap", ui32.AQLQueueDoubleMap);
584 ROCP_SDK_SAVE_DATA_BITFIELD("DebugTrapSupported", ui32.DebugTrapSupported);
585 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchTrapOverrideSupported",
586 ui32.WaveLaunchTrapOverrideSupported);
587 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchModeSupported", ui32.WaveLaunchModeSupported);
588 ROCP_SDK_SAVE_DATA_BITFIELD("PreciseMemoryOperationsSupported",
589 ui32.PreciseMemoryOperationsSupported);
590 ROCP_SDK_SAVE_DATA_BITFIELD("DEPRECATED_SRAM_EDCSupport", ui32.DEPRECATED_SRAM_EDCSupport);
591 ROCP_SDK_SAVE_DATA_BITFIELD("Mem_EDCSupport", ui32.Mem_EDCSupport);
592 ROCP_SDK_SAVE_DATA_BITFIELD("RASEventNotify", ui32.RASEventNotify);
593 ROCP_SDK_SAVE_DATA_BITFIELD("ASICRevision", ui32.ASICRevision);
594 ROCP_SDK_SAVE_DATA_BITFIELD("SRAM_EDCSupport", ui32.SRAM_EDCSupport);
595 ROCP_SDK_SAVE_DATA_BITFIELD("SVMAPISupported", ui32.SVMAPISupported);
596 ROCP_SDK_SAVE_DATA_BITFIELD("CoherentHostAccess", ui32.CoherentHostAccess);
597 ROCP_SDK_SAVE_DATA_BITFIELD("DebugSupportedFirmware", ui32.DebugSupportedFirmware);
598 ROCP_SDK_SAVE_DATA_BITFIELD("Reserved", ui32.Reserved);
599}
600
601template <typename ArchiveT>
602void
603save(ArchiveT& ar, HSA_MEMORYPROPERTY data)
604{
605 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
606 ROCP_SDK_SAVE_DATA_BITFIELD("NonVolatile", ui32.NonVolatile);
607}
608
609template <typename ArchiveT>
610void
611save(ArchiveT& ar, HSA_ENGINE_VERSION data)
612{
613 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeSDMA", uCodeSDMA);
614 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeRes", uCodeRes);
615}
616
617template <typename ArchiveT>
618void
619save(ArchiveT& ar, HSA_ENGINE_ID data)
620{
621 ROCP_SDK_SAVE_DATA_BITFIELD("uCode", ui32.uCode);
622 ROCP_SDK_SAVE_DATA_BITFIELD("Major", ui32.Major);
623 ROCP_SDK_SAVE_DATA_BITFIELD("Minor", ui32.Minor);
624 ROCP_SDK_SAVE_DATA_BITFIELD("Stepping", ui32.Stepping);
625}
626
627template <typename ArchiveT>
628void
630{
631 ROCP_SDK_SAVE_DATA_FIELD(processor_id_low);
634 ROCP_SDK_SAVE_DATA_FIELD(cache_line_size);
635 ROCP_SDK_SAVE_DATA_FIELD(cache_lines_per_tag);
636 ROCP_SDK_SAVE_DATA_FIELD(association);
639}
640
641template <typename ArchiveT>
642void
644{
646 ROCP_SDK_SAVE_DATA_FIELD(version_major);
647 ROCP_SDK_SAVE_DATA_FIELD(version_minor);
648 ROCP_SDK_SAVE_DATA_FIELD(node_from);
651 ROCP_SDK_SAVE_DATA_FIELD(min_latency);
652 ROCP_SDK_SAVE_DATA_FIELD(max_latency);
653 ROCP_SDK_SAVE_DATA_FIELD(min_bandwidth);
654 ROCP_SDK_SAVE_DATA_FIELD(max_bandwidth);
655 ROCP_SDK_SAVE_DATA_FIELD(recommended_transfer_size);
657}
658
659template <typename ArchiveT>
660void
662{
663 ROCP_SDK_SAVE_DATA_FIELD(heap_type);
666 ROCP_SDK_SAVE_DATA_FIELD(mem_clk_max);
667 ROCP_SDK_SAVE_DATA_FIELD(size_in_bytes);
668}
669
670template <typename ArchiveT>
671void
680
681template <typename ArchiveT>
682void
683save(ArchiveT& ar, const rocprofiler_agent_v0_t& data)
684{
688 ROCP_SDK_SAVE_DATA_FIELD(cpu_cores_count);
689 ROCP_SDK_SAVE_DATA_FIELD(simd_count);
690 ROCP_SDK_SAVE_DATA_FIELD(mem_banks_count);
691 ROCP_SDK_SAVE_DATA_FIELD(caches_count);
692 ROCP_SDK_SAVE_DATA_FIELD(io_links_count);
693 ROCP_SDK_SAVE_DATA_FIELD(cpu_core_id_base);
694 ROCP_SDK_SAVE_DATA_FIELD(simd_id_base);
695 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_simd);
696 ROCP_SDK_SAVE_DATA_FIELD(lds_size_in_kb);
697 ROCP_SDK_SAVE_DATA_FIELD(gds_size_in_kb);
699 ROCP_SDK_SAVE_DATA_FIELD(wave_front_size);
701 ROCP_SDK_SAVE_DATA_FIELD(cu_count);
702 ROCP_SDK_SAVE_DATA_FIELD(array_count);
703 ROCP_SDK_SAVE_DATA_FIELD(num_shader_banks);
704 ROCP_SDK_SAVE_DATA_FIELD(simd_arrays_per_engine);
705 ROCP_SDK_SAVE_DATA_FIELD(cu_per_simd_array);
706 ROCP_SDK_SAVE_DATA_FIELD(simd_per_cu);
707 ROCP_SDK_SAVE_DATA_FIELD(max_slots_scratch_cu);
708 ROCP_SDK_SAVE_DATA_FIELD(gfx_target_version);
709 ROCP_SDK_SAVE_DATA_FIELD(vendor_id);
710 ROCP_SDK_SAVE_DATA_FIELD(device_id);
711 ROCP_SDK_SAVE_DATA_FIELD(location_id);
713 ROCP_SDK_SAVE_DATA_FIELD(drm_render_minor);
714 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_engines);
715 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_xgmi_engines);
716 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_queues_per_engine);
717 ROCP_SDK_SAVE_DATA_FIELD(num_cp_queues);
718 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_ccompute);
719 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_fcompute);
720 ROCP_SDK_SAVE_DATA_FIELD(sdma_fw_version);
721 ROCP_SDK_SAVE_DATA_FIELD(fw_version);
722 ROCP_SDK_SAVE_DATA_FIELD(capability);
723 ROCP_SDK_SAVE_DATA_FIELD(cu_per_engine);
724 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_cu);
725 ROCP_SDK_SAVE_DATA_FIELD(family_id);
726 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_size);
727 ROCP_SDK_SAVE_DATA_FIELD(grid_max_size);
728 ROCP_SDK_SAVE_DATA_FIELD(local_mem_size);
731 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_dim);
732 ROCP_SDK_SAVE_DATA_FIELD(grid_max_dim);
734 ROCP_SDK_SAVE_DATA_CSTR(vendor_name);
735 ROCP_SDK_SAVE_DATA_CSTR(product_name);
736 ROCP_SDK_SAVE_DATA_CSTR(model_name);
738 ROCP_SDK_SAVE_DATA_FIELD(logical_node_id);
739
740 auto generate = [&](auto name, const auto* value, uint64_t size) {
741 using value_type = std::remove_const_t<std::remove_pointer_t<decltype(value)>>;
742 auto vec = std::vector<value_type>{};
743 vec.reserve(size);
744 for(uint64_t i = 0; i < size; ++i)
745 vec.emplace_back(value[i]);
746 ar(make_nvp(name, vec));
747 };
748
749 generate("mem_banks", data.mem_banks, data.mem_banks_count);
750 generate("caches", data.caches, data.caches_count);
751 generate("io_links", data.io_links, data.io_links_count);
752}
753
754template <typename ArchiveT>
755void
757{
759 ROCP_SDK_SAVE_DATA_BITFIELD("is_constant", is_constant);
760 ROCP_SDK_SAVE_DATA_BITFIELD("is_derived", is_derived);
762 ROCP_SDK_SAVE_DATA_CSTR(description);
764 ROCP_SDK_SAVE_DATA_CSTR(expression);
765}
766
767template <typename ArchiveT>
768void
775
776template <typename ArchiveT, typename EnumT, typename ValueT>
777void
779{
780 ar.makeArray();
781 for(const auto& itr : data)
782 ar(cereal::make_nvp("entry", itr));
783}
784
785template <typename ArchiveT, typename EnumT, typename ValueT>
786void
788{
789 auto _name = std::string{data.name};
790 auto _ops = std::vector<std::string>{};
791 _ops.reserve(data.operations.size());
792
793 ar(cereal::make_nvp("kind", _name));
794 for(auto itr : data.operations)
795 _ops.emplace_back(itr);
796 ar(cereal::make_nvp("operations", _ops));
797}
798
800
801#undef ROCP_SDK_SAVE_DATA_FIELD
802#undef ROCP_SDK_SAVE_DATA_VALUE
803#undef ROCP_SDK_SAVE_DATA_CSTR
804#undef ROCP_SDK_SAVE_DATA_BITFIELD
const rocprofiler_agent_io_link_t * io_links
Definition agent.h:185
uint32_t mem_banks_count
Definition agent.h:121
uint32_t caches_count
Definition agent.h:123
const rocprofiler_agent_mem_bank_t * mem_banks
Definition agent.h:183
uint32_t io_links_count
Definition agent.h:124
const rocprofiler_agent_cache_t * caches
Definition agent.h:184
Cache information for an agent.
Definition agent.h:56
Memory bank information for an agent.
Definition agent.h:91
Stores the properties of an agent (CPU, GPU, etc.)
Definition agent.h:111
@ ROCPROFILER_PAGE_MIGRATION_NONE
Unknown event.
Definition fwd.h:228
@ ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND
Definition fwd.h:231
@ ROCPROFILER_PAGE_MIGRATION_LAST
Definition fwd.h:235
@ ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU
Definition fwd.h:232
@ ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT
Definition fwd.h:230
@ ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE
Definition fwd.h:229
Agent Identifier.
Definition fwd.h:541
Context ID.
Definition fwd.h:502
ROCProfiler Record Correlation ID.
Definition fwd.h:518
Counter ID.
Definition fwd.h:549
Counter info struct version 0.
Definition fwd.h:704
Multi-dimensional struct of data used to describe GPU workgroup and grid sizes.
Definition fwd.h:566
ROCProfiler kernel dispatch information.
Definition fwd.h:653
ROCProfiler Profile Counting Counter Record per instance.
Definition fwd.h:683
Details for the dimension, including its size, for a counter record.
Definition fwd.h:670
ROCProfiler Buffer Correlation ID Retirement Tracer Record.
ROCProfiler Buffer HIP API Tracer Record.
ROCProfiler Buffer HSA API Tracer Record.
ROCProfiler Buffer Kernel Dispatch Tracer Record.
ROCProfiler Buffer Marker Tracer Record.
ROCProfiler Buffer Memory Copy Tracer Record.
ROCProfiler Buffer Page Migration Tracer Record.
ROCProfiler Buffer Scratch Memory Tracer Record.
rocprofiler_code_object_storage_type_t storage_type
storage type of the code object reader used to load the loaded code object
@ ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY
@ ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE
ROCProfiler Code Object Kernel Symbol Tracer Callback Record.
ROCProfiler Code Object Load Tracer Callback Record.
ROCProfiler HIP runtime and compiler API Tracer Callback Data.
ROCProfiler HSA API Callback Data.
ROCProfiler Kernel Dispatch Callback Tracer Record.
ROCProfiler Marker Tracer Callback Data.
ROCProfiler Memory Copy Callback Tracer Record.
ROCProfiler Scratch Memory Callback Data.
Kernel dispatch data for profile counting callbacks.
ROCProfiler Profile Counting Counter Record Header Information.
PC sampling configuration supported by a GPU agent.
void save(ArchiveT &ar, rocprofiler_context_id_t data)
void save_buffer_tracing_api_record(ArchiveT &ar, Tp data)
#define ROCP_SDK_SAVE_DATA_CSTR(FIELD)
#define ROCP_SDK_SAVE_DATA_BITFIELD(NAME, VALUE)
#define ROCP_SDK_SAVE_DATA_FIELD(FIELD)
#define ROCPROFILER_SDK_CEREAL_NAMESPACE_END
#define ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN
#define ROCP_SDK_SAVE_DATA_VALUE(NAME, VALUE)
std::vector< value_type > operations
Definition name_info.hpp:61