Files
rocm-systems/rocclr/runtime/device/rocm/rockernel.hpp
T
foreman 01710a66ac P4 to Git Change 1725166 by gandryey@gera-w8 on 2019/01/02 15:41:59
SWDEV-79445 - OCL generic changes and code clean-up
	- Add dynamic switch between HSAIL and LC in ROCr path

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#108 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#48 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#26 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#95 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.hpp#42 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#71 edit
2019-01-02 16:03:55 -05:00

84 行
2.9 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_;
};
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;
};
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;
};
} // namespace roc
#endif // WITHOUT_HSA_BACKEND