Skip to content

Commit

Permalink
added multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
101001000 committed Sep 4, 2023
1 parent c39c792 commit c390377
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/CommandManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ RenderParameters ConfigTCPLoadInputCommand::load() {
json_data["sample_target"].as_int64(),
json_data["denoise"].as_bool(),
json_data["device"].as_string().c_str(),
json_data["platform"].as_string().c_str(),
json_data["block_size"].as_int64());
}
catch (std::exception const& e) {
Expand Down
16 changes: 10 additions & 6 deletions src/Managers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,15 @@ class CUDASelector : public sycl::device_selector {

class NameSelector : public sycl::device_selector {
public:
std::string name;
std::string name, platname;

NameSelector(std::string _name) : name(_name) {};
NameSelector(std::string _name, std::string _platname) : name(_name), platname(_platname) {};

int operator()(const sycl::device& device) const override {
if (device.get_info<sycl::info::device::name>() == name) {

sycl::platform plat = device.get_info<sycl::info::device::platform>();

if (device.get_info<sycl::info::device::name>() == name && plat.get_info<sycl::info::platform::name>() == platname) {
return 1;
}
else {
Expand Down Expand Up @@ -238,8 +241,8 @@ void RenderingManager::start_rendering(Scene* scene) {
LOG(trace) << "RenderingManager::start_rendering()";

try {
k_q = sycl::queue(NameSelector(rd.pars.device));
d_q = sycl::queue(NameSelector(rd.pars.device));
k_q = sycl::queue(NameSelector(rd.pars.device, rd.pars.platform));
d_q = sycl::queue(NameSelector(rd.pars.device, rd.pars.platform));
}
catch (std::exception const& e) {
LOG(error) << e.what();
Expand All @@ -248,14 +251,15 @@ void RenderingManager::start_rendering(Scene* scene) {
sycl::device device = k_q.get_device();

LOG(info) << "Device selected: " << device.get_info<sycl::info::device::name>();
LOG(info) << "Platform selected: " << device.get_info<sycl::info::device::platform>().get_info<sycl::info::platform::name>();

auto work_item_dim = device.get_info<sycl::info::device::max_work_item_dimensions>();
//auto work_item_size = device.get_info<sycl::info::device::max_work_item_sizes>();
auto work_item_group_size = device.get_info<sycl::info::device::max_work_group_size>();

//auto test = sycl::info::device::max_work_item_dimensions

//LOG(info) << "dim " << work_item_dim << " is_x: " << work_item_size[0] << " is_y: " << work_item_size[1] << " is_z: " << work_item_size[2] << " gs: " << work_item_group_size;
LOG(info) << "dim " << work_item_dim << " gs: " << work_item_group_size;

dev_scene = sycl::malloc_device<dev_Scene>(1, k_q);

Expand Down
4 changes: 2 additions & 2 deletions src/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ struct RenderParameters {
unsigned int width, height;
unsigned int sampleTarget;
unsigned int block_size;
std::string device;
std::string device, platform;
bool denoise;

bool passes_enabled[PASSES_COUNT];

RenderParameters(unsigned int width, unsigned int height, unsigned int sampleTarget, bool denoise, std::string _device, unsigned int _block_size) : width(width), height(height), sampleTarget(sampleTarget), denoise(denoise), device(_device), block_size(_block_size) {
RenderParameters(unsigned int width, unsigned int height, unsigned int sampleTarget, bool denoise, std::string _device, std::string _platform, unsigned int _block_size) : width(width), height(height), sampleTarget(sampleTarget), denoise(denoise), device(_device), platform(_platform), block_size(_block_size) {
passes_enabled[BEAUTY] = true;
passes_enabled[DENOISE] = true;
passes_enabled[NORMAL] = true;
Expand Down

0 comments on commit c390377

Please sign in to comment.