-
Notifications
You must be signed in to change notification settings - Fork 190
Support feature selection for device #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
d1bf263
627f4d9
b575837
fa4e4f0
f5b00f8
6668ba7
fcb8db9
1e45ab5
ab3e221
cf4f255
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| pyshader==0.7.0 | ||
| numpy==1.22.4 | ||
| pytest==7.1.2 | ||
|
|
||
| pytest-forked==1.6.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,25 +33,43 @@ debugMessageCallback(VkDebugReportFlagsEXT /*flags*/, | |
| } | ||
| #endif | ||
|
|
||
| static void setUpLogger() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we moving this? |
||
| // Make sure the logger is setup | ||
| #if !KOMPUTE_OPT_LOG_LEVEL_DISABLED | ||
| logger::setupLogger(); | ||
| #endif | ||
| } | ||
|
|
||
| Manager::Manager() | ||
| : Manager(0) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this removed? |
||
| { | ||
| this->mManageResources = true; | ||
| setUpLogger(); | ||
| this->createInstance(); | ||
| this->createDevice( | ||
| {}, 0, {}, nullptr); | ||
| } | ||
|
|
||
| Manager::Manager(uint32_t physicalDeviceIndex, | ||
| const std::vector<uint32_t>& familyQueueIndices, | ||
| const std::vector<std::string>& desiredExtensions) | ||
| { | ||
| this->mManageResources = true; | ||
| setUpLogger(); | ||
| this->createInstance(); | ||
| this->createDevice( | ||
| familyQueueIndices, physicalDeviceIndex, desiredExtensions, nullptr); | ||
| } | ||
|
|
||
| // Make sure the logger is setup | ||
| #if !KOMPUTE_OPT_LOG_LEVEL_DISABLED | ||
| logger::setupLogger(); | ||
| #endif | ||
|
|
||
| Manager::Manager(uint32_t physicalDeviceIndex, | ||
| const vk::PhysicalDeviceFeatures& desiredFeatures, | ||
| const std::vector<uint32_t>& familyQueueIndices, | ||
| const std::vector<std::string>& desiredExtensions) | ||
| { | ||
| this->mManageResources = true; | ||
| setUpLogger(); | ||
| this->createInstance(); | ||
| this->createDevice( | ||
| familyQueueIndices, physicalDeviceIndex, desiredExtensions); | ||
| familyQueueIndices, physicalDeviceIndex, desiredExtensions, &desiredFeatures); | ||
| } | ||
|
|
||
| Manager::Manager(std::shared_ptr<vk::Instance> instance, | ||
|
|
@@ -64,10 +82,7 @@ Manager::Manager(std::shared_ptr<vk::Instance> instance, | |
| this->mPhysicalDevice = physicalDevice; | ||
| this->mDevice = device; | ||
|
|
||
| // Make sure the logger is setup | ||
| #if !KOMPUTE_OPT_LOG_LEVEL_DISABLED | ||
| logger::setupLogger(); | ||
| #endif | ||
| setUpLogger(); | ||
| } | ||
|
|
||
| Manager::~Manager() | ||
|
|
@@ -312,7 +327,8 @@ Manager::clear() | |
| void | ||
| Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices, | ||
| uint32_t physicalDeviceIndex, | ||
| const std::vector<std::string>& desiredExtensions) | ||
| const std::vector<std::string>& desiredExtensions, | ||
| const vk::PhysicalDeviceFeatures* pDesiredFeatures) | ||
| { | ||
|
|
||
| KP_LOG_DEBUG("Kompute Manager creating Device"); | ||
|
|
@@ -436,7 +452,8 @@ Manager::createDevice(const std::vector<uint32_t>& familyQueueIndices, | |
| {}, | ||
| {}, | ||
| validExtensions.size(), | ||
| validExtensions.data()); | ||
| validExtensions.data(), | ||
| pDesiredFeatures); | ||
|
|
||
| this->mDevice = std::make_shared<vk::Device>(); | ||
| physicalDevice.createDevice( | ||
|
|
@@ -483,6 +500,12 @@ Manager::getDeviceProperties() const | |
| return this->mPhysicalDevice->getProperties(); | ||
| } | ||
|
|
||
| vk::PhysicalDeviceFeatures | ||
| Manager::getDeviceFeatures() const | ||
| { | ||
| return this->mPhysicalDevice->getFeatures(); | ||
| } | ||
|
|
||
| std::vector<vk::PhysicalDevice> | ||
| Manager::listDevices() const | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,13 +30,32 @@ class Manager | |
| * @param physicalDeviceIndex The index of the physical device to use | ||
| * @param familyQueueIndices (Optional) List of queue indices to add for | ||
| * explicit allocation | ||
| * @param desiredExtensions The desired extensions to load from | ||
| * @param desiredExtensions (Optional) The desired extensions to load from | ||
| * physicalDevice | ||
| * @param desiredFeatures (Optional) The desired features to include | ||
| * in the physical device | ||
| */ | ||
| Manager(uint32_t physicalDeviceIndex, | ||
| const std::vector<uint32_t>& familyQueueIndices = {}, | ||
| const std::vector<std::string>& desiredExtensions = {}); | ||
|
|
||
| /** | ||
| * Similar to second constructor but allows for further configuration | ||
| * for Vulkan device features. | ||
| * | ||
| * @param physicalDeviceIndex The index of the physical device to use | ||
| * @param desiredFeatures The desired features to request from the | ||
| * physical device | ||
| * @param familyQueueIndices (Optional) List of queue indices to add for | ||
| * explicit allocation | ||
| * @param desiredExtensions (Optional) The desired extensions to load from | ||
| * physicalDevice | ||
| */ | ||
| Manager(uint32_t physicalDeviceIndex, | ||
| const vk::PhysicalDeviceFeatures& desiredFeatures, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need another constructor instead of just adding a new optional param to the previous constructor? |
||
| const std::vector<uint32_t>& familyQueueIndices = {}, | ||
| const std::vector<std::string>& desiredExtensions = {}); | ||
|
|
||
| /** | ||
| * Manager constructor which allows your own vulkan application to integrate | ||
| * with the kompute use. | ||
|
|
@@ -505,6 +524,14 @@ class Manager | |
| **/ | ||
| vk::PhysicalDeviceProperties getDeviceProperties() const; | ||
|
|
||
| /** | ||
| * Information about the current device features. | ||
| * | ||
| * @return vk::PhysicalDeviceFeatures containing information about the | ||
| *device features | ||
| **/ | ||
| vk::PhysicalDeviceFeatures getDeviceFeatures() const; | ||
|
|
||
| /** | ||
| * List the devices available in the current vulkan instance. | ||
| * | ||
|
|
@@ -547,7 +574,8 @@ class Manager | |
| void createInstance(); | ||
| void createDevice(const std::vector<uint32_t>& familyQueueIndices = {}, | ||
| uint32_t hysicalDeviceIndex = 0, | ||
| const std::vector<std::string>& desiredExtensions = {}); | ||
| const std::vector<std::string>& desiredExtensions = {}, | ||
| const vk::PhysicalDeviceFeatures* pDesiredFeatures = nullptr); | ||
| }; | ||
|
|
||
| } // End namespace kp | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,7 @@ TEST(TestAsyncOperations, TestManagerParallelExecution) | |
| EXPECT_EQ(inputsSyncB[i]->vector<float>(), resultSync); | ||
| } | ||
|
|
||
| kp::Manager mgrAsync(0, { 0, 2 }); | ||
| kp::Manager mgrAsync(0, std::vector<uint32_t>{ 0, 2 }); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this needed? |
||
|
|
||
| std::vector<std::shared_ptr<kp::Memory>> inputsAsyncB; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?