Files
rocm-systems/rocclr/runtime/device/pal/palthreadtrace.hpp
T
foreman 892bda4554 P4 to Git Change 1293980 by jatang@jatang-opencl-hsa-stg3 on 2016/07/21 10:22:49
SWDEV-95919 - OCL ThreadTrace on PAL.

	The PAL PerfExperiment interface is not compatible with the  OCL ThreadTrace extension, in terms of Thread Trace buffer handling. PAL PerfExperiment is expecting one buffer bound to it for all shader engines, while the OCL ThreadTrace extension is expecting one buffer for each shader engines. To accomodate the difference, we copy from the PAL PerfExperiment buffer to the  OCL ThreadTrace extension buffers.

	The next step is to support setting ThreadTrace parameters, and getting actually capture size from the layout.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palthreadtrace.hpp#3 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#18 edit
2016-07-21 10:32:54 -04:00

122 lines
3.7 KiB
C++

//
// Copyright (c) 2015 Advanced Micro Devices, Inc. All rights reserved.
//
#pragma once
#include "top.hpp"
#include "device/device.hpp"
#include "device/pal/paldevice.hpp"
#include "palPerfExperiment.h"
#include <vector>
namespace pal {
class VirtualGPU;
class PalThreadTraceReference : public amd::ReferenceCountedObject
{
public:
static PalThreadTraceReference* Create(VirtualGPU& gpu);
//! Default constructor
PalThreadTraceReference(
VirtualGPU& gpu //!< Virtual GPU device object
)
: perfExp_(nullptr)
, gpu_(gpu)
, memory_(nullptr)
, layout_(nullptr) {}
//! Get PAL thread race object
Pal::IPerfExperiment* iPerf() const { return perfExp_; }
//! Returns the virtual GPU device
const VirtualGPU& gpu() const { return gpu_; }
//! Prepare for execution
bool finalize();
//! Copy ThreadTrace capture to User Buffer
void copyToUserBuffer(Memory* dstMem, uint seIndex);
protected:
//! Default destructor
~PalThreadTraceReference();
private:
//! Disable copy constructor
PalThreadTraceReference(const PalThreadTraceReference&);
//! Disable operator=
PalThreadTraceReference& operator=(const PalThreadTraceReference&);
VirtualGPU& gpu_; //!< The virtual GPU device object
Pal::IPerfExperiment* perfExp_; //!< PAL performance experiment object
Pal::ThreadTraceLayout* layout_; //!< Layout of the result
Memory* memory_; //!< Memory bound to PerfExperiment
};
//! ThreadTrace implementation on GPU
class ThreadTrace : public device::ThreadTrace
{
public:
//! Constructor for the GPU ThreadTrace object
ThreadTrace(
Device& device, //!< A GPU device object
PalThreadTraceReference* palRef, //!< Reference ThreadTrace
const std::vector<amd::Memory*>& memObjs, //!< ThreadTrace memory objects
uint numSe //!< Number of Shader Engines
)
: gpuDevice_(device)
, palRef_(palRef)
, memObj_(memObjs)
, numSe_(numSe)
{
}
//! Destructor for the GPU ThreadTrace object
virtual ~ThreadTrace();
//! Creates the current object
bool create();
// Populate ThreadTrace memory with PerfExperiment memory
void populateUserMemory();
//! Returns the specific information about the thread trace object
bool info(
uint infoType, //!< The type of returned information
uint* info, //!< The returned information
uint infoSize //!< The size of returned information
) const;
//! Set isNewBufferBinded_ to true/false if new buffer was binded/unbinded respectively
void setNewBufferBinded(bool isNewBufferBinded) {}
//! 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 palRef_->gpu(); }
//! Get PAL thread trace object
Pal::IPerfExperiment* iPerf() const { return palRef_->iPerf(); }
private:
//! Disable default copy constructor
ThreadTrace(const ThreadTrace&);
//! Disable default operator=
ThreadTrace& operator=(const ThreadTrace&);
const Device& gpuDevice_; //!< The backend device
PalThreadTraceReference* palRef_; //!< Reference ThreadTrace
uint numSe_; //!< Number of Shader Engines
std::vector<amd::Memory*> memObj_; //!< ThreadTrace memory objects
};
} // namespace pal