Path: blob/21.2-virgl/src/gallium/frontends/clover/core/device.hpp
4572 views
//1// Copyright 2012 Francisco Jerez2//3// Permission is hereby granted, free of charge, to any person obtaining a4// copy of this software and associated documentation files (the "Software"),5// to deal in the Software without restriction, including without limitation6// the rights to use, copy, modify, merge, publish, distribute, sublicense,7// and/or sell copies of the Software, and to permit persons to whom the8// Software is furnished to do so, subject to the following conditions:9//10// The above copyright notice and this permission notice shall be included in11// all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19// OTHER DEALINGS IN THE SOFTWARE.20//2122#ifndef CLOVER_CORE_DEVICE_HPP23#define CLOVER_CORE_DEVICE_HPP2425#include <set>26#include <vector>2728#include "core/object.hpp"29#include "core/format.hpp"30#include "core/module.hpp"31#include "util/lazy.hpp"32#include "pipe-loader/pipe_loader.h"3334struct nir_shader;35struct disk_cache;3637namespace clover {38class platform;39class root_resource;40class hard_event;4142class device : public ref_counter, public _cl_device_id {43public:44device(clover::platform &platform, pipe_loader_device *ldev);45~device();4647device(const device &dev) = delete;48device &49operator=(const device &dev) = delete;5051bool52operator==(const device &dev) const;5354cl_device_type type() const;55cl_uint vendor_id() const;56size_t max_images_read() const;57size_t max_images_write() const;58size_t max_image_buffer_size() const;59// Use for 1D and 2D images.60cl_uint max_image_size() const;61// Use for 3D images.62cl_uint max_image_size_3d() const;63size_t max_image_array_number() const;64cl_uint max_samplers() const;65cl_ulong max_mem_global() const;66cl_ulong max_mem_local() const;67cl_ulong max_mem_input() const;68cl_ulong max_const_buffer_size() const;69cl_uint max_const_buffers() const;70size_t max_threads_per_block() const;71cl_ulong max_mem_alloc_size() const;72cl_uint max_clock_frequency() const;73cl_uint max_compute_units() const;74cl_uint max_printf_buffer_size() const;75bool image_support() const;76bool has_doubles() const;77bool has_halves() const;78bool has_int64_atomics() const;79bool has_unified_memory() const;80size_t mem_base_addr_align() const;81cl_device_svm_capabilities svm_support() const;82bool allows_user_pointers() const;8384std::vector<size_t> max_block_size() const;85cl_uint subgroup_size() const;86cl_uint address_bits() const;87std::string device_name() const;88std::string vendor_name() const;89std::string device_version_as_string() const;90std::string device_clc_version_as_string() const;91enum pipe_shader_ir ir_format() const;92std::string ir_target() const;93enum pipe_endian endianness() const;94bool supports_ir(enum pipe_shader_ir ir) const;95std::string supported_extensions_as_string() const;96cl_version device_version() const;97cl_version device_clc_version() const;98std::vector<cl_name_version> opencl_c_all_versions() const;99std::vector<cl_name_version> supported_extensions() const;100std::vector<cl_name_version> supported_il_versions() const;101102std::vector<cl_name_version> opencl_c_features() const;103104friend class command_queue;105friend class root_resource;106friend class hard_event;107friend std::set<cl_image_format>108supported_formats(const context &, cl_mem_object_type);109const void *get_compiler_options(enum pipe_shader_ir ir) const;110111clover::platform &platform;112113inline bool114has_system_svm() const {115return svm_support() & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM;116}117118lazy<std::shared_ptr<nir_shader>> clc_nir;119disk_cache *clc_cache;120cl_version version;121cl_version clc_version;122private:123pipe_screen *pipe;124pipe_loader_device *ldev;125};126}127128#endif129130131