forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GPACounterGeneratorDX12.h
76 lines (59 loc) · 3.08 KB
/
GPACounterGeneratorDX12.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//==============================================================================
// Copyright (c) 2015-2017 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief Class for DX12 counter generation
//==============================================================================
#ifndef _GPA_COUNTER_GENERATOR_DX12_H_
#define _GPA_COUNTER_GENERATOR_DX12_H_
#include "GPACounterGeneratorDX12Base.h"
/// The DX12-specific counter generator
class GPA_CounterGeneratorDX12 : public GPA_CounterGeneratorDX12Base
{
public:
/// Constructor
GPA_CounterGeneratorDX12();
/// Destructor
virtual ~GPA_CounterGeneratorDX12();
protected:
/// \copydoc GPA_CounterGeneratorBase::GeneratePublicCounters
virtual GPA_Status GeneratePublicCounters(
GDT_HW_GENERATION desiredGeneration,
GDT_HW_ASIC_TYPE asicType,
gpa_uint8 generateAsicSpecificCounters,
GPA_PublicCounters* pPublicCounters) override;
/// \copydoc GPA_CounterGeneratorBase::GenerateHardwareCounters
virtual GPA_Status GenerateHardwareCounters(
GDT_HW_GENERATION desiredGeneration,
GDT_HW_ASIC_TYPE asicType,
gpa_uint8 generateAsicSpecificCounters,
GPA_HardwareCounters* pHardwareCounters) override;
private:
/// Helper function to indicates whether the specified HW generation represents an AMD GPU
/// \param generation the hw generation to check
/// \return true if the specified HW generation represents an AMD GPU
static bool IsAMDGPU(GDT_HW_GENERATION generation);
/// Logic inside this function is based on the AmdExtGpuBlock enum in AmdExtGpaInterface in DXCP driver.
/// The driver gives each block an ID, but ignores the instance. GPA treats each instance as a different
/// block, so we need to translate.
/// \param generation the generation whose block id needs to be calculated
/// \param pGroup the group for which the block id needs to be calculated
/// \return the block id according to the driver
static UINT CalculateBlockIdDX12(GDT_HW_GENERATION generation, GPA_CounterGroupDesc* pGroup);
/// Generates internal counters
/// \param pHardwareCounters the hardware counters to generate
/// \param generation the generation for which counters need to be generated
/// \return true on success
static bool GenerateInternalCounters(GPA_HardwareCounters* pHardwareCounters, GDT_HW_GENERATION generation);
/// Copy constructor - private override to prevent usage
GPA_CounterGeneratorDX12(const GPA_CounterGeneratorDX12Base&) = delete;
/// Move constructor - private override to prevent usage
GPA_CounterGeneratorDX12(GPA_CounterGeneratorDX12Base&&) = delete;
/// Copy operator - private override to prevent usage
/// \return reference to object
GPA_CounterGeneratorDX12& operator=(const GPA_CounterGeneratorDX12&) = delete;
/// Move operator - private override to prevent usage
/// \return reference to object
GPA_CounterGeneratorDX12& operator=(GPA_CounterGeneratorDX12&&) = delete;
};
#endif // _GPA_COUNTER_GENERATOR_DX12_H_