c99d679c9e
SWDEV-86035 - Add OCL backend for PAL - PAL backend build is disabled by default. "BUILD_PAL_DEVICE = yes" enables the build. You also have to update the client workspace with PAL mapping: //depot/stg/pal/... //<your_opencl_location>/runtime/device/pal/palbe/... Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/build/Makefile.api#130 edit ... //depot/stg/opencl/drivers/opencl/compiler/sclibdefs.opencl#8 edit ... //depot/stg/opencl/drivers/opencl/opencldefs#166 edit ... //depot/stg/opencl/drivers/opencl/openclrules#91 edit ... //depot/stg/opencl/drivers/opencl/runtime/Makefile#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#192 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/Makefile#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/build/Makefile#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/build/Makefile.pal#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palappprofile.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palappprofile.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palbinary.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palbinary.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palconstbuf.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugger.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugmanager.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldebugmanager.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d10.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d11.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldeviced3d9.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevicegl.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsched.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palschedcl.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltimestamp.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltimestamp.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paltrap.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palwavelimiter.cpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palwavelimiter.hpp#1 add ... //depot/stg/opencl/drivers/opencl/runtime/runtimedefs#36 edit ... //depot/stg/opencl/drivers/opencl/runtime/top.hpp#23 edit
153 lines
4.5 KiB
C++
153 lines
4.5 KiB
C++
//
|
|
// Copyright (c) 2015 Advanced Micro Devices, Inc. All rights reserved.
|
|
//
|
|
#ifndef PALCOUNTERS_HPP_
|
|
#define PALCOUNTERS_HPP_
|
|
|
|
#include "top.hpp"
|
|
#include "device/device.hpp"
|
|
#include "device/pal/paldevice.hpp"
|
|
#include "palPerfExperiment.h"
|
|
|
|
namespace pal {
|
|
|
|
class VirtualGPU;
|
|
|
|
class PalCounterReference : public amd::ReferenceCountedObject
|
|
{
|
|
public:
|
|
static PalCounterReference* Create(
|
|
VirtualGPU& gpu,
|
|
const Pal::PerfExperimentCreateInfo& createInfo);
|
|
|
|
//! Default constructor
|
|
PalCounterReference(
|
|
VirtualGPU& gpu //!< Virtual GPU device object
|
|
)
|
|
: perfExp_(nullptr)
|
|
, gpu_(gpu)
|
|
, results_(nullptr) {}
|
|
|
|
//! Get PAL counter
|
|
Pal::IPerfExperiment* iPerf() const { return perfExp_; }
|
|
|
|
//! Returns the virtual GPU device
|
|
const VirtualGPU& gpu() const { return gpu_; }
|
|
|
|
//! Increases the results array for this PAL counter(container)
|
|
bool growResultArray(
|
|
uint maxIndex //!< the maximum HW counter index in the PAL counter
|
|
);
|
|
|
|
void finalize() {
|
|
iPerf()->Finalize();
|
|
Pal::GlobalCounterLayout layout = {};
|
|
layout.sampleCount = referenceCount() - 1;
|
|
iPerf()->GetGlobalCounterLayout(&layout); }
|
|
|
|
//! Returns the PAL counter results
|
|
uint64_t* results() const { return results_; }
|
|
|
|
Pal::IPerfExperiment* perfExp_; //!< PAL performance experiment object
|
|
|
|
protected:
|
|
//! Default destructor
|
|
~PalCounterReference();
|
|
|
|
private:
|
|
//! Disable copy constructor
|
|
PalCounterReference(const PalCounterReference&);
|
|
|
|
//! Disable operator=
|
|
PalCounterReference& operator=(const PalCounterReference&);
|
|
|
|
VirtualGPU& gpu_; //!< The virtual GPU device object
|
|
uint64_t* results_; //!< Counter results
|
|
};
|
|
|
|
//! Performance counter implementation on GPU
|
|
class PerfCounter : public device::PerfCounter
|
|
{
|
|
public:
|
|
//! The performance counter info
|
|
struct Info : public amd::EmbeddedObject
|
|
{
|
|
uint blockIndex_; //!< Index of the block to configure
|
|
uint counterIndex_; //!< Index of the hardware counter
|
|
uint eventIndex_; //!< Event you wish to count with the counter
|
|
};
|
|
|
|
//! The PerfCounter flags
|
|
enum Flags
|
|
{
|
|
BeginIssued = 0x00000001,
|
|
EndIssued = 0x00000002,
|
|
ResultReady = 0x00000004
|
|
};
|
|
|
|
//! Constructor for the GPU PerfCounter object
|
|
PerfCounter(
|
|
const Device& device, //!< A GPU device object
|
|
const VirtualGPU& gpu, //!< Virtual GPU device object
|
|
cl_uint blockIndex, //!< HW block index
|
|
cl_uint counterIndex, //!< Counter index within the block
|
|
cl_uint eventIndex) //!< Event index for profiling
|
|
: gpuDevice_(device)
|
|
, gpu_(gpu)
|
|
, calRef_(NULL)
|
|
, flags_(0)
|
|
, counter_(0)
|
|
, index_(0)
|
|
{
|
|
info_.blockIndex_ = blockIndex;
|
|
info_.counterIndex_ = counterIndex;
|
|
info_.eventIndex_ = eventIndex;
|
|
}
|
|
|
|
//! Destructor for the GPU PerfCounter object
|
|
virtual ~PerfCounter();
|
|
|
|
//! Creates the current object
|
|
bool create(
|
|
PalCounterReference* calRef //!< Reference counter
|
|
);
|
|
|
|
//! Returns the specific information about the counter
|
|
uint64_t getInfo(
|
|
uint64_t infoType //!< The type of returned information
|
|
) const;
|
|
|
|
//! Returns the GPU device, associated with the current object
|
|
const Device& dev() const { return gpuDevice_; }
|
|
|
|
//! Returns the virtual GPU device
|
|
const VirtualGPU& gpu() const { return gpu_; }
|
|
|
|
//! Returns the CAL performance counter descriptor
|
|
const Info* info() const { return &info_; }
|
|
|
|
//! Returns the Info structure for performance counter
|
|
Pal::IPerfExperiment* iPerf() const { return counter_; }
|
|
|
|
private:
|
|
//! Disable default copy constructor
|
|
PerfCounter(const PerfCounter&);
|
|
|
|
//! Disable default operator=
|
|
PerfCounter& operator=(const PerfCounter&);
|
|
|
|
const Device& gpuDevice_; //!< The backend device
|
|
const VirtualGPU& gpu_; //!< The virtual GPU device object
|
|
|
|
PalCounterReference* calRef_; //!< Reference counter
|
|
uint flags_; //!< The perfcounter object state
|
|
Info info_; //!< The info structure for perfcounter
|
|
Pal::IPerfExperiment* counter_; //!< GSL counter object
|
|
uint index_; //!< Counter index in the CAL container
|
|
};
|
|
|
|
} // namespace pal
|
|
|
|
#endif // PALCOUNTERS_HPP_
|
|
|