파일
rocm-systems/rocclr/runtime/device/rocm/rockernel.hpp
T
foreman ef83d84899 P4 to Git Change 1599194 by gandryey@gera-w8 on 2018/08/28 18:38:33
SWDEV-79445 - OCL generic changes and code clean-up
	- Move printf setup in the kernels to the abstraction layer

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.hpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#329 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#131 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.cpp#47 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.hpp#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#238 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#71 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#62 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.hpp#4 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#41 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#25 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#11 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#6 edit
2018-08-28 18:48:05 -04:00

88 라인
3.0 KiB
C++

//
// Copyright (c) 2009 Advanced Micro Devices, Inc. All rights reserved.
//
#pragma once
#include <memory>
#include "acl.h"
#include "rocprogram.hpp"
#include "top.hpp"
#include "rocprintf.hpp"
#ifndef WITHOUT_HSA_BACKEND
namespace roc {
#define MAX_INFO_STRING_LEN 0x40
class Kernel : public device::Kernel {
public:
Kernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle,
const uint32_t workgroupGroupSegmentByteSize,
const uint32_t workitemPrivateSegmentByteSize, const uint32_t kernargSegmentByteSize,
const uint32_t kernargSegmentAlignment);
const uint64_t& KernelCodeHandle() { return kernelCodeHandle_; }
const uint32_t WorkgroupGroupSegmentByteSize() const { return workgroupGroupSegmentByteSize_; }
const uint32_t workitemPrivateSegmentByteSize() const { return workitemPrivateSegmentByteSize_; }
const uint32_t KernargSegmentByteSize() const { return kernargSegmentByteSize_; }
const uint8_t KernargSegmentAlignment() const { return kernargSegmentAlignment_; }
~Kernel() {}
//! Initializes the metadata required for this kernel
virtual bool init() = 0;
const Program* program() const { return static_cast<const Program*>(program_); }
protected:
Program* program_; //!< The roc::Program context
uint64_t kernelCodeHandle_; //!< Kernel code handle (aka amd_kernel_code_t)
const uint32_t workgroupGroupSegmentByteSize_;
const uint32_t workitemPrivateSegmentByteSize_;
const uint32_t kernargSegmentByteSize_;
const uint32_t kernargSegmentAlignment_;
size_t kernelDirectiveOffset_;
};
#if defined(WITH_COMPILER_LIB)
class HSAILKernel : public roc::Kernel {
public:
HSAILKernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle,
const uint32_t workgroupGroupSegmentByteSize,
const uint32_t workitemPrivateSegmentByteSize,
const uint32_t kernargSegmentByteSize,
const uint32_t kernargSegmentAlignment)
: roc::Kernel(name, prog, kernelCodeHandle, workgroupGroupSegmentByteSize,
workitemPrivateSegmentByteSize, kernargSegmentByteSize, kernargSegmentAlignment) {
}
//! Initializes the metadata required for this kernel
virtual bool init() final;
};
#endif // defined(WITH_COMPILER_LIB)
#if defined(WITH_LIGHTNING_COMPILER)
class LightningKernel : public roc::Kernel {
public:
LightningKernel(std::string name, Program* prog, const uint64_t& kernelCodeHandle,
const uint32_t workgroupGroupSegmentByteSize,
const uint32_t workitemPrivateSegmentByteSize,
const uint32_t kernargSegmentByteSize,
const uint32_t kernargSegmentAlignment)
: roc::Kernel(name, prog, kernelCodeHandle, workgroupGroupSegmentByteSize,
workitemPrivateSegmentByteSize, kernargSegmentByteSize, kernargSegmentAlignment) {
}
//! Initializes the metadata required for this kernel
virtual bool init() final;
};
#endif // defined(WITH_LIGHTNING_COMPILER)
} // namespace roc
#endif // WITHOUT_HSA_BACKEND