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.4.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(dispatch_info);
337}
338
339template <typename ArchiveT>
340void
342{
344 ROCP_SDK_SAVE_DATA_FIELD(num_records);
345 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
346 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
347}
348
349template <typename ArchiveT>
350void
352{
353 ROCP_SDK_SAVE_DATA_FIELD(context_id);
354 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
356 ROCP_SDK_SAVE_DATA_FIELD(operation);
357 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
359}
360
361template <typename ArchiveT, typename Tp>
362void
363save_buffer_tracing_api_record(ArchiveT& ar, Tp data)
364{
367 ROCP_SDK_SAVE_DATA_FIELD(operation);
368 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
369 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
370 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
371 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
372}
373
374template <typename ArchiveT>
375void
380
381template <typename ArchiveT>
382void
384{
386 ROCP_SDK_SAVE_DATA_FIELD(counter_value);
387 ROCP_SDK_SAVE_DATA_FIELD(dispatch_id);
388}
389
390template <typename ArchiveT>
391void
396
397template <typename ArchiveT>
398void
403
404template <typename ArchiveT>
405void
407{
410 ROCP_SDK_SAVE_DATA_FIELD(operation);
411 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
412 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
413 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
414 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
415 ROCP_SDK_SAVE_DATA_FIELD(dispatch_info);
416}
417
418template <typename ArchiveT>
419void
421{
424 ROCP_SDK_SAVE_DATA_FIELD(operation);
425 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
426 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
427 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
428 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
429 ROCP_SDK_SAVE_DATA_FIELD(dst_agent_id);
430 ROCP_SDK_SAVE_DATA_FIELD(src_agent_id);
432}
433
434template <typename ArchiveT>
435void
437{
440 ROCP_SDK_SAVE_DATA_FIELD(operation);
441 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
442 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
444
445 switch(data.operation)
446 {
448 {
449 ar(make_nvp("page_fault", data.page_fault));
450 break;
451 }
453 {
454 ar(make_nvp("page_migrate", data.page_migrate));
455 break;
456 }
458 {
459 ar(make_nvp("queue_suspend", data.queue_suspend));
460 break;
461 }
463 {
464 ar(make_nvp("unmap_from_gpu", data.unmap_from_gpu));
465 break;
466 }
469 {
470 throw std::runtime_error{"unsupported page migration operation type"};
471 break;
472 }
473 }
474}
475
476template <typename ArchiveT>
477void
485
486template <typename ArchiveT>
487void
489{
490 ROCP_SDK_SAVE_DATA_FIELD(start_addr);
491 ROCP_SDK_SAVE_DATA_FIELD(end_addr);
492 ROCP_SDK_SAVE_DATA_FIELD(from_node);
494 ROCP_SDK_SAVE_DATA_FIELD(prefetch_node);
495 ROCP_SDK_SAVE_DATA_FIELD(preferred_node);
497}
498
499template <typename ArchiveT>
500void
507
508template <typename ArchiveT>
509void
517
518template <typename ArchiveT>
519void
521{
524 ROCP_SDK_SAVE_DATA_FIELD(operation);
525 ROCP_SDK_SAVE_DATA_FIELD(agent_id);
526 ROCP_SDK_SAVE_DATA_FIELD(queue_id);
527 ROCP_SDK_SAVE_DATA_FIELD(thread_id);
528 ROCP_SDK_SAVE_DATA_FIELD(start_timestamp);
529 ROCP_SDK_SAVE_DATA_FIELD(end_timestamp);
530 ROCP_SDK_SAVE_DATA_FIELD(correlation_id);
532}
533
534template <typename ArchiveT>
535void
543
544template <typename ArchiveT>
545void
546save(ArchiveT& ar, HsaCacheType data)
547{
548 ROCP_SDK_SAVE_DATA_BITFIELD("Data", ui32.Data);
549 ROCP_SDK_SAVE_DATA_BITFIELD("Instruction", ui32.Instruction);
550 ROCP_SDK_SAVE_DATA_BITFIELD("CPU", ui32.CPU);
551 ROCP_SDK_SAVE_DATA_BITFIELD("HSACU", ui32.HSACU);
552}
553
554template <typename ArchiveT>
555void
556save(ArchiveT& ar, HSA_LINKPROPERTY data)
557{
558 ROCP_SDK_SAVE_DATA_BITFIELD("Override", ui32.Override);
559 ROCP_SDK_SAVE_DATA_BITFIELD("NonCoherent", ui32.NonCoherent);
560 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics32bit", ui32.NoAtomics32bit);
561 ROCP_SDK_SAVE_DATA_BITFIELD("NoAtomics64bit", ui32.NoAtomics64bit);
562 ROCP_SDK_SAVE_DATA_BITFIELD("NoPeerToPeerDMA", ui32.NoPeerToPeerDMA);
563}
564
565template <typename ArchiveT>
566void
567save(ArchiveT& ar, HSA_CAPABILITY data)
568{
569 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
570 ROCP_SDK_SAVE_DATA_BITFIELD("HSAMMUPresent", ui32.HSAMMUPresent);
571 ROCP_SDK_SAVE_DATA_BITFIELD("SharedWithGraphics", ui32.SharedWithGraphics);
572 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSizePowerOfTwo", ui32.QueueSizePowerOfTwo);
573 ROCP_SDK_SAVE_DATA_BITFIELD("QueueSize32bit", ui32.QueueSize32bit);
574 ROCP_SDK_SAVE_DATA_BITFIELD("QueueIdleEvent", ui32.QueueIdleEvent);
575 ROCP_SDK_SAVE_DATA_BITFIELD("VALimit", ui32.VALimit);
576 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsSupported", ui32.WatchPointsSupported);
577 ROCP_SDK_SAVE_DATA_BITFIELD("WatchPointsTotalBits", ui32.WatchPointsTotalBits);
578 ROCP_SDK_SAVE_DATA_BITFIELD("DoorbellType", ui32.DoorbellType);
579 ROCP_SDK_SAVE_DATA_BITFIELD("AQLQueueDoubleMap", ui32.AQLQueueDoubleMap);
580 ROCP_SDK_SAVE_DATA_BITFIELD("DebugTrapSupported", ui32.DebugTrapSupported);
581 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchTrapOverrideSupported",
582 ui32.WaveLaunchTrapOverrideSupported);
583 ROCP_SDK_SAVE_DATA_BITFIELD("WaveLaunchModeSupported", ui32.WaveLaunchModeSupported);
584 ROCP_SDK_SAVE_DATA_BITFIELD("PreciseMemoryOperationsSupported",
585 ui32.PreciseMemoryOperationsSupported);
586 ROCP_SDK_SAVE_DATA_BITFIELD("DEPRECATED_SRAM_EDCSupport", ui32.DEPRECATED_SRAM_EDCSupport);
587 ROCP_SDK_SAVE_DATA_BITFIELD("Mem_EDCSupport", ui32.Mem_EDCSupport);
588 ROCP_SDK_SAVE_DATA_BITFIELD("RASEventNotify", ui32.RASEventNotify);
589 ROCP_SDK_SAVE_DATA_BITFIELD("ASICRevision", ui32.ASICRevision);
590 ROCP_SDK_SAVE_DATA_BITFIELD("SRAM_EDCSupport", ui32.SRAM_EDCSupport);
591 ROCP_SDK_SAVE_DATA_BITFIELD("SVMAPISupported", ui32.SVMAPISupported);
592 ROCP_SDK_SAVE_DATA_BITFIELD("CoherentHostAccess", ui32.CoherentHostAccess);
593 ROCP_SDK_SAVE_DATA_BITFIELD("DebugSupportedFirmware", ui32.DebugSupportedFirmware);
594 ROCP_SDK_SAVE_DATA_BITFIELD("Reserved", ui32.Reserved);
595}
596
597template <typename ArchiveT>
598void
599save(ArchiveT& ar, HSA_MEMORYPROPERTY data)
600{
601 ROCP_SDK_SAVE_DATA_BITFIELD("HotPluggable", ui32.HotPluggable);
602 ROCP_SDK_SAVE_DATA_BITFIELD("NonVolatile", ui32.NonVolatile);
603}
604
605template <typename ArchiveT>
606void
607save(ArchiveT& ar, HSA_ENGINE_VERSION data)
608{
609 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeSDMA", uCodeSDMA);
610 ROCP_SDK_SAVE_DATA_BITFIELD("uCodeRes", uCodeRes);
611}
612
613template <typename ArchiveT>
614void
615save(ArchiveT& ar, HSA_ENGINE_ID data)
616{
617 ROCP_SDK_SAVE_DATA_BITFIELD("uCode", ui32.uCode);
618 ROCP_SDK_SAVE_DATA_BITFIELD("Major", ui32.Major);
619 ROCP_SDK_SAVE_DATA_BITFIELD("Minor", ui32.Minor);
620 ROCP_SDK_SAVE_DATA_BITFIELD("Stepping", ui32.Stepping);
621}
622
623template <typename ArchiveT>
624void
626{
627 ROCP_SDK_SAVE_DATA_FIELD(processor_id_low);
630 ROCP_SDK_SAVE_DATA_FIELD(cache_line_size);
631 ROCP_SDK_SAVE_DATA_FIELD(cache_lines_per_tag);
632 ROCP_SDK_SAVE_DATA_FIELD(association);
635}
636
637template <typename ArchiveT>
638void
640{
642 ROCP_SDK_SAVE_DATA_FIELD(version_major);
643 ROCP_SDK_SAVE_DATA_FIELD(version_minor);
644 ROCP_SDK_SAVE_DATA_FIELD(node_from);
647 ROCP_SDK_SAVE_DATA_FIELD(min_latency);
648 ROCP_SDK_SAVE_DATA_FIELD(max_latency);
649 ROCP_SDK_SAVE_DATA_FIELD(min_bandwidth);
650 ROCP_SDK_SAVE_DATA_FIELD(max_bandwidth);
651 ROCP_SDK_SAVE_DATA_FIELD(recommended_transfer_size);
653}
654
655template <typename ArchiveT>
656void
658{
659 ROCP_SDK_SAVE_DATA_FIELD(heap_type);
662 ROCP_SDK_SAVE_DATA_FIELD(mem_clk_max);
663 ROCP_SDK_SAVE_DATA_FIELD(size_in_bytes);
664}
665
666template <typename ArchiveT>
667void
676
677template <typename ArchiveT>
678void
679save(ArchiveT& ar, const rocprofiler_agent_v0_t& data)
680{
684 ROCP_SDK_SAVE_DATA_FIELD(cpu_cores_count);
685 ROCP_SDK_SAVE_DATA_FIELD(simd_count);
686 ROCP_SDK_SAVE_DATA_FIELD(mem_banks_count);
687 ROCP_SDK_SAVE_DATA_FIELD(caches_count);
688 ROCP_SDK_SAVE_DATA_FIELD(io_links_count);
689 ROCP_SDK_SAVE_DATA_FIELD(cpu_core_id_base);
690 ROCP_SDK_SAVE_DATA_FIELD(simd_id_base);
691 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_simd);
692 ROCP_SDK_SAVE_DATA_FIELD(lds_size_in_kb);
693 ROCP_SDK_SAVE_DATA_FIELD(gds_size_in_kb);
695 ROCP_SDK_SAVE_DATA_FIELD(wave_front_size);
697 ROCP_SDK_SAVE_DATA_FIELD(cu_count);
698 ROCP_SDK_SAVE_DATA_FIELD(array_count);
699 ROCP_SDK_SAVE_DATA_FIELD(num_shader_banks);
700 ROCP_SDK_SAVE_DATA_FIELD(simd_arrays_per_engine);
701 ROCP_SDK_SAVE_DATA_FIELD(cu_per_simd_array);
702 ROCP_SDK_SAVE_DATA_FIELD(simd_per_cu);
703 ROCP_SDK_SAVE_DATA_FIELD(max_slots_scratch_cu);
704 ROCP_SDK_SAVE_DATA_FIELD(gfx_target_version);
705 ROCP_SDK_SAVE_DATA_FIELD(vendor_id);
706 ROCP_SDK_SAVE_DATA_FIELD(device_id);
707 ROCP_SDK_SAVE_DATA_FIELD(location_id);
709 ROCP_SDK_SAVE_DATA_FIELD(drm_render_minor);
710 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_engines);
711 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_xgmi_engines);
712 ROCP_SDK_SAVE_DATA_FIELD(num_sdma_queues_per_engine);
713 ROCP_SDK_SAVE_DATA_FIELD(num_cp_queues);
714 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_ccompute);
715 ROCP_SDK_SAVE_DATA_FIELD(max_engine_clk_fcompute);
716 ROCP_SDK_SAVE_DATA_FIELD(sdma_fw_version);
717 ROCP_SDK_SAVE_DATA_FIELD(fw_version);
718 ROCP_SDK_SAVE_DATA_FIELD(capability);
719 ROCP_SDK_SAVE_DATA_FIELD(cu_per_engine);
720 ROCP_SDK_SAVE_DATA_FIELD(max_waves_per_cu);
721 ROCP_SDK_SAVE_DATA_FIELD(family_id);
722 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_size);
723 ROCP_SDK_SAVE_DATA_FIELD(grid_max_size);
724 ROCP_SDK_SAVE_DATA_FIELD(local_mem_size);
727 ROCP_SDK_SAVE_DATA_FIELD(workgroup_max_dim);
728 ROCP_SDK_SAVE_DATA_FIELD(grid_max_dim);
730 ROCP_SDK_SAVE_DATA_CSTR(vendor_name);
731 ROCP_SDK_SAVE_DATA_CSTR(product_name);
732 ROCP_SDK_SAVE_DATA_CSTR(model_name);
734 ROCP_SDK_SAVE_DATA_FIELD(logical_node_id);
735
736 auto generate = [&](auto name, const auto* value, uint64_t size) {
737 using value_type = std::remove_const_t<std::remove_pointer_t<decltype(value)>>;
738 auto vec = std::vector<value_type>{};
739 vec.reserve(size);
740 for(uint64_t i = 0; i < size; ++i)
741 vec.emplace_back(value[i]);
742 ar(make_nvp(name, vec));
743 };
744
745 generate("mem_banks", data.mem_banks, data.mem_banks_count);
746 generate("caches", data.caches, data.caches_count);
747 generate("io_links", data.io_links, data.io_links_count);
748}
749
750template <typename ArchiveT>
751void
753{
755 ROCP_SDK_SAVE_DATA_BITFIELD("is_constant", is_constant);
756 ROCP_SDK_SAVE_DATA_BITFIELD("is_derived", is_derived);
758 ROCP_SDK_SAVE_DATA_CSTR(description);
760 ROCP_SDK_SAVE_DATA_CSTR(expression);
761}
762
763template <typename ArchiveT>
764void
771
772template <typename ArchiveT, typename EnumT, typename ValueT>
773void
775{
776 ar.makeArray();
777 for(const auto& itr : data)
778 ar(cereal::make_nvp("entry", itr));
779}
780
781template <typename ArchiveT, typename EnumT, typename ValueT>
782void
784{
785 auto _name = std::string{data.name};
786 auto _ops = std::vector<std::string>{};
787 _ops.reserve(data.operations.size());
788
789 ar(cereal::make_nvp("kind", _name));
790 for(auto itr : data.operations)
791 _ops.emplace_back(itr);
792 ar(cereal::make_nvp("operations", _ops));
793}
794
796
797#undef ROCP_SDK_SAVE_DATA_FIELD
798#undef ROCP_SDK_SAVE_DATA_VALUE
799#undef ROCP_SDK_SAVE_DATA_CSTR
800#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