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{
334 ROCP_SDK_SAVE_DATA_FIELD(ncclResult_t_retval);
335}
336
337template <typename ArchiveT>
338void
340{
342 // ROCP_SDK_SAVE_DATA_FIELD(args);
344}
345
346template <typename ArchiveT>
347void
349{
351 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
352 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
353 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
354 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
355}
356
357template <typename ArchiveT>
358void
360{
362 ROCP_SDK_SAVE_DATA_FIELD(num_records);
363 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
364 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
365 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
366 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
367}
368
369template <typename ArchiveT>
370void
372{
373 ROCP_SDK_SAVE_DATA_FIELD(context_id);
374 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
376 ROCP_SDK_SAVE_DATA_FIELD(operation);
377 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
379}
380
381template <typename ArchiveT, typename Tp>
382void
383save_buffer_tracing_api_record(ArchiveT& ar, Tp data)
384{
387 ROCP_SDK_SAVE_DATA_FIELD(operation);
388 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
389 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
390 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
391 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
392}
393
394template <typename ArchiveT>
395void
400
401template <typename ArchiveT>
402void
404{
406 ROCP_SDK_SAVE_DATA_FIELD(counter_value);
407 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
408}
409
410template <typename ArchiveT>
411void
416
417template <typename ArchiveT>
418void
423
424template <typename ArchiveT>
425void
430
431template <typename ArchiveT>
432void
434{
437 ROCP_SDK_SAVE_DATA_FIELD(operation);
438 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
439 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
440 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
441 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
442 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
443}
444
445template <typename ArchiveT>
446void
448{
451 ROCP_SDK_SAVE_DATA_FIELD(operation);
452 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
453 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
454 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
455 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
456 ROCP_SDK_SAVE_DATA_FIELD(dst_agent_id);
457 ROCP_SDK_SAVE_DATA_FIELD(src_agent_id);
459}
460
461template <typename ArchiveT>
462void
464{
467 ROCP_SDK_SAVE_DATA_FIELD(operation);
468 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
469 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
471
472 switch(data.operation)
473 {
475 {
476 ar(make_nvp("page_fault", data.page_fault));
477 break;
478 }
480 {
481 ar(make_nvp("page_migrate", data.page_migrate));
482 break;
483 }
485 {
486 ar(make_nvp("queue_suspend", data.queue_suspend));
487 break;
488 }
490 {
491 ar(make_nvp("unmap_from_gpu", data.unmap_from_gpu));
492 break;
493 }
496 {
497 throw std::runtime_error{"unsupported page migration operation type"};
498 break;
499 }
500 }
501}
502
503template <typename ArchiveT>
504void
512
513template <typename ArchiveT>
514void
516{
517 ROCP_SDK_SAVE_DATA_FIELD(start_addr);
518 ROCP_SDK_SAVE_DATA_FIELD(end_addr);
519 ROCP_SDK_SAVE_DATA_FIELD(from_node);
521 ROCP_SDK_SAVE_DATA_FIELD(prefetch_node);
522 ROCP_SDK_SAVE_DATA_FIELD(preferred_node);
524}
525
526template <typename ArchiveT>
527void
534
535template <typename ArchiveT>
536void
544
545template <typename ArchiveT>
546void
548{
551 ROCP_SDK_SAVE_DATA_FIELD(operation);
552 ROCP_SDK_SAVE_DATA_FIELD(agent_id);
553 ROCP_SDK_SAVE_DATA_FIELD(queue_id);
554 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
555 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
556 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
557 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
559}
560
561template <typename ArchiveT>
562void
570
571template <typename ArchiveT>
572void
573save(ArchiveT& ar, HsaCacheType data)
574{
575 ROCP_SDK_SAVE_DATA_BITFIELD("Data", ui32.Data);
576 ROCP_SDK_SAVE_DATA_BITFIELD("Instruction", ui32.Instruction);
577 ROCP_SDK_SAVE_DATA_BITFIELD("CPU", ui32.CPU);
578 ROCP_SDK_SAVE_DATA_BITFIELD("HSACU", ui32.HSACU);
579}
580
581template <typename ArchiveT>
582void
583save(ArchiveT& ar, HSA_LINKPROPERTY data)
584{
585 ROCP_SDK_SAVE_DATA_BITFIELD("Override", ui32.Override);
586 ROCP_SDK_SAVE_DATA_BITFIELD("NonCoherent", ui32.NonCoherent);
587 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics32bit", ui32.NoAtomics32bit);
588 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics64bit", ui32.NoAtomics64bit);
589 ROCP_SDK_SAVE_DATA_BITFIELD("NoPeerToPeerDMA", ui32.NoPeerToPeerDMA);
590}
591
592template <typename ArchiveT>
593void
594save(ArchiveT& ar, HSA_CAPABILITY data)
595{
596 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
597 ROCP_SDK_SAVE_DATA_BITFIELD("HSAMMUPresent", ui32.HSAMMUPresent);
598 ROCP_SDK_SAVE_DATA_BITFIELD("SharedWithGraphics", ui32.SharedWithGraphics);
599 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSizePowerOfTwo", ui32.QueueSizePowerOfTwo);
600 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSize32bit", ui32.QueueSize32bit);
601 ROCP_SDK_SAVE_DATA_BITFIELD("QueueIdleEvent", ui32.QueueIdleEvent);
602 ROCP_SDK_SAVE_DATA_BITFIELD("VALimit", ui32.VALimit);
603 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsSupported", ui32.WatchPointsSupported);
604 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsTotalBits", ui32.WatchPointsTotalBits);
605 ROCP_SDK_SAVE_DATA_BITFIELD("DoorbellType", ui32.DoorbellType);
606 ROCP_SDK_SAVE_DATA_BITFIELD("AQLQueueDoubleMap", ui32.AQLQueueDoubleMap);
607 ROCP_SDK_SAVE_DATA_BITFIELD("DebugTrapSupported", ui32.DebugTrapSupported);
608 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchTrapOverrideSupported",
609 ui32.WaveLaunchTrapOverrideSupported);
610 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchModeSupported", ui32.WaveLaunchModeSupported);
611 ROCP_SDK_SAVE_DATA_BITFIELD("PreciseMemoryOperationsSupported",
612 ui32.PreciseMemoryOperationsSupported);
613 ROCP_SDK_SAVE_DATA_BITFIELD("DEPRECATED_SRAM_EDCSupport", ui32.DEPRECATED_SRAM_EDCSupport);
614 ROCP_SDK_SAVE_DATA_BITFIELD("Mem_EDCSupport", ui32.Mem_EDCSupport);
615 ROCP_SDK_SAVE_DATA_BITFIELD("RASEventNotify", ui32.RASEventNotify);
616 ROCP_SDK_SAVE_DATA_BITFIELD("ASICRevision", ui32.ASICRevision);
617 ROCP_SDK_SAVE_DATA_BITFIELD("SRAM_EDCSupport", ui32.SRAM_EDCSupport);
618 ROCP_SDK_SAVE_DATA_BITFIELD("SVMAPISupported", ui32.SVMAPISupported);
619 ROCP_SDK_SAVE_DATA_BITFIELD("CoherentHostAccess", ui32.CoherentHostAccess);
620 ROCP_SDK_SAVE_DATA_BITFIELD("DebugSupportedFirmware", ui32.DebugSupportedFirmware);
621}
622
623template <typename ArchiveT>
624void
625save(ArchiveT& ar, HSA_MEMORYPROPERTY data)
626{
627 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
628 ROCP_SDK_SAVE_DATA_BITFIELD("NonVolatile", ui32.NonVolatile);
629}
630
631template <typename ArchiveT>
632void
633save(ArchiveT& ar, HSA_ENGINE_VERSION data)
634{
635 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeSDMA", uCodeSDMA);
636 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeRes", uCodeRes);
637}
638
639template <typename ArchiveT>
640void
641save(ArchiveT& ar, HSA_ENGINE_ID data)
642{
643 ROCP_SDK_SAVE_DATA_BITFIELD("uCode", ui32.uCode);
644 ROCP_SDK_SAVE_DATA_BITFIELD("Major", ui32.Major);
645 ROCP_SDK_SAVE_DATA_BITFIELD("Minor", ui32.Minor);
646 ROCP_SDK_SAVE_DATA_BITFIELD("Stepping", ui32.Stepping);
647}
648
649template <typename ArchiveT>
650void
652{
653 ROCP_SDK_SAVE_DATA_FIELD(processor_id_low);
656 ROCP_SDK_SAVE_DATA_FIELD(cache_line_size);
657 ROCP_SDK_SAVE_DATA_FIELD(cache_lines_per_tag);
658 ROCP_SDK_SAVE_DATA_FIELD(association);
661}
662
663template <typename ArchiveT>
664void
666{
668 ROCP_SDK_SAVE_DATA_FIELD(version_major);
669 ROCP_SDK_SAVE_DATA_FIELD(version_minor);
670 ROCP_SDK_SAVE_DATA_FIELD(node_from);
673 ROCP_SDK_SAVE_DATA_FIELD(min_latency);
674 ROCP_SDK_SAVE_DATA_FIELD(max_latency);
675 ROCP_SDK_SAVE_DATA_FIELD(min_bandwidth);
676 ROCP_SDK_SAVE_DATA_FIELD(max_bandwidth);
677 ROCP_SDK_SAVE_DATA_FIELD(recommended_transfer_size);
679}
680
681template <typename ArchiveT>
682void
684{
685 ROCP_SDK_SAVE_DATA_FIELD(heap_type);
688 ROCP_SDK_SAVE_DATA_FIELD(mem_clk_max);
689 ROCP_SDK_SAVE_DATA_FIELD(size_in_bytes);
690}
691
692template <typename ArchiveT>
693void
702
703template <typename ArchiveT>
704void
705save(ArchiveT& ar, const rocprofiler_agent_v0_t& data)
706{
710 ROCP_SDK_SAVE_DATA_FIELD(cpu_cores_count);
711 ROCP_SDK_SAVE_DATA_FIELD(simd_count);
712 ROCP_SDK_SAVE_DATA_FIELD(mem_banks_count);
713 ROCP_SDK_SAVE_DATA_FIELD(caches_count);
714 ROCP_SDK_SAVE_DATA_FIELD(io_links_count);
715 ROCP_SDK_SAVE_DATA_FIELD(cpu_core_id_base);
716 ROCP_SDK_SAVE_DATA_FIELD(simd_id_base);
717 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_simd);
718 ROCP_SDK_SAVE_DATA_FIELD(lds_size_in_kb);
719 ROCP_SDK_SAVE_DATA_FIELD(gds_size_in_kb);
721 ROCP_SDK_SAVE_DATA_FIELD(wave_front_size);
723 ROCP_SDK_SAVE_DATA_FIELD(cu_count);
724 ROCP_SDK_SAVE_DATA_FIELD(array_count);
725 ROCP_SDK_SAVE_DATA_FIELD(num_shader_banks);
726 ROCP_SDK_SAVE_DATA_FIELD(simd_arrays_per_engine);
727 ROCP_SDK_SAVE_DATA_FIELD(cu_per_simd_array);
728 ROCP_SDK_SAVE_DATA_FIELD(simd_per_cu);
729 ROCP_SDK_SAVE_DATA_FIELD(max_slots_scratch_cu);
730 ROCP_SDK_SAVE_DATA_FIELD(gfx_target_version);
731 ROCP_SDK_SAVE_DATA_FIELD(vendor_id);
732 ROCP_SDK_SAVE_DATA_FIELD(device_id);
733 ROCP_SDK_SAVE_DATA_FIELD(location_id);
735 ROCP_SDK_SAVE_DATA_FIELD(drm_render_minor);
736 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_engines);
737 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_xgmi_engines);
738 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_queues_per_engine);
739 ROCP_SDK_SAVE_DATA_FIELD(num_cp_queues);
740 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_ccompute);
741 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_fcompute);
742 ROCP_SDK_SAVE_DATA_FIELD(sdma_fw_version);
743 ROCP_SDK_SAVE_DATA_FIELD(fw_version);
744 ROCP_SDK_SAVE_DATA_FIELD(capability);
745 ROCP_SDK_SAVE_DATA_FIELD(cu_per_engine);
746 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_cu);
747 ROCP_SDK_SAVE_DATA_FIELD(family_id);
748 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_size);
749 ROCP_SDK_SAVE_DATA_FIELD(grid_max_size);
750 ROCP_SDK_SAVE_DATA_FIELD(local_mem_size);
753 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_dim);
754 ROCP_SDK_SAVE_DATA_FIELD(grid_max_dim);
756 ROCP_SDK_SAVE_DATA_CSTR(vendor_name);
757 ROCP_SDK_SAVE_DATA_CSTR(product_name);
758 ROCP_SDK_SAVE_DATA_CSTR(model_name);
760 ROCP_SDK_SAVE_DATA_FIELD(logical_node_id);
761
762 auto generate = [&](auto name, const auto* value, uint64_t size) {
763 using value_type = std::remove_const_t<std::remove_pointer_t<decltype(value)>>;
764 auto vec = std::vector<value_type>{};
765 vec.reserve(size);
766 for(uint64_t i = 0; i < size; ++i)
767 vec.emplace_back(value[i]);
768 ar(make_nvp(name, vec));
769 };
770
771 generate("mem_banks", data.mem_banks, data.mem_banks_count);
772 generate("caches", data.caches, data.caches_count);
773 generate("io_links", data.io_links, data.io_links_count);
774}
775
776template <typename ArchiveT>
777void
779{
781 ROCP_SDK_SAVE_DATA_BITFIELD("is_constant", is_constant);
782 ROCP_SDK_SAVE_DATA_BITFIELD("is_derived", is_derived);
784 ROCP_SDK_SAVE_DATA_CSTR(description);
786 ROCP_SDK_SAVE_DATA_CSTR(expression);
787}
788
789template <typename ArchiveT>
790void
797
798template <typename ArchiveT, typename EnumT, typename ValueT>
799void
801{
802 ar.makeArray();
803 for(const auto& itr : data)
804 ar(cereal::make_nvp("entry", itr));
805}
806
807template <typename ArchiveT, typename EnumT, typename ValueT>
808void
810{
811 auto _name = std::string{data.name};
812 auto _ops = std::vector<std::string>{};
813 _ops.reserve(data.operations.size());
814
815 ar(cereal::make_nvp("kind", _name));
816 for(auto itr : data.operations)
817 _ops.emplace_back(itr);
818 ar(cereal::make_nvp("operations", _ops));
819}
820
822
823#undef ROCP_SDK_SAVE_DATA_FIELD
824#undef ROCP_SDK_SAVE_DATA_VALUE
825#undef ROCP_SDK_SAVE_DATA_CSTR
826#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:232
@ ROCPROFILER_PAGE_MIGRATION_QUEUE_SUSPEND
Definition fwd.h:235
@ ROCPROFILER_PAGE_MIGRATION_LAST
Definition fwd.h:239
@ ROCPROFILER_PAGE_MIGRATION_UNMAP_FROM_GPU
Definition fwd.h:236
@ ROCPROFILER_PAGE_MIGRATION_PAGE_FAULT
Definition fwd.h:234
@ ROCPROFILER_PAGE_MIGRATION_PAGE_MIGRATE
Definition fwd.h:233
Agent Identifier.
Definition fwd.h:545
Context ID.
Definition fwd.h:506
ROCProfiler Record Correlation ID.
Definition fwd.h:522
Counter ID.
Definition fwd.h:553
Counter info struct version 0.
Definition fwd.h:709
Multi-dimensional struct of data used to describe GPU workgroup and grid sizes.
Definition fwd.h:570
ROCProfiler kernel dispatch information.
Definition fwd.h:657
ROCProfiler Profile Counting Counter Record per instance.
Definition fwd.h:687
Details for the dimension, including its size, for a counter record.
Definition fwd.h:674
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 RCCL API 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 RCCL API Callback Data.
ROCProfiler Scratch Memory Callback Data.
PC sampling configuration supported by a GPU agent.
Kernel dispatch data for profile counting callbacks.
ROCProfiler Profile Counting Counter Record Header Information.
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