Skip to content

Commit 248e514

Browse files
committed
Updated VkFFT version
-small fixes
1 parent 6a4ea28 commit 248e514

File tree

3 files changed

+437
-250
lines changed

3 files changed

+437
-250
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ VkResample has a command-line interface with the following set of commands:\
3939
-h: print help\
4040
-devices: print the list of available GPU devices\
4141
-d X: select GPU device (default 0)\
42-
-u X: specify upscale factor (float, make sure that upscaled image can be represented as a multiplication of 2s, 3s and 5s)\
42+
-u X: specify upscale factor (float, make sure that upscaled image can be represented as a multiplication of 2s, 3s, 5s and 7s)\
4343
-p X: specify precision (0 - single, 1 - double, 2 - half, default - single)\
4444
-s X: specify sharpening factor, range 0.0-0.2 (default 0.2) \
4545
-n X: specify how many times to perform upscale. This removes dispatch overhead and will show the real application performance (default 1)\

VkResample.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,6 @@ static VkResult launchResample(VkResampleConfiguration config) {
13211321
vkGetPhysicalDeviceProperties(vkGPU.physicalDevice, &vkGPU.physicalDeviceProperties);
13221322
vkGetPhysicalDeviceMemoryProperties(vkGPU.physicalDevice, &vkGPU.physicalDeviceMemoryProperties);
13231323

1324-
glslang_initialize_process();//compiler can be initialized before VkFFT
13251324
uint32_t isCompilerInitialized = 1;
13261325
if (config.threadId==0)
13271326
printf("VkResample - FFT based upscaling\n");
@@ -1447,7 +1446,8 @@ static VkResult launchResample(VkResampleConfiguration config) {
14471446
allocateFFTBuffer(&vkGPU, &inputBuffer, &inputBufferDeviceMemory, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_HEAP_DEVICE_LOCAL_BIT, inputBufferSize);
14481447
allocateFFTBuffer(&vkGPU, &buffer, &bufferDeviceMemory, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_HEAP_DEVICE_LOCAL_BIT, bufferSize);
14491448
allocateFFTBuffer(&vkGPU, &tempBuffer, &tempBufferDeviceMemory, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_HEAP_DEVICE_LOCAL_BIT, bufferSize);
1450-
1449+
1450+
if (config.threadId==0) printf("VRAM per thread: %d MB Total: %d MB\n", ((inputBufferSize + (bufferSize + bufferSize)))/1024/1024, config.numThreads*((inputBufferSize + (bufferSize + bufferSize))) / 1024 / 1024);
14511451
forward_configuration.buffer = &buffer;
14521452
forward_configuration.tempBuffer = &tempBuffer;
14531453
forward_configuration.inputBuffer = &inputBuffer; //you can specify first buffer to read data from to be different from the buffer FFT is performed on. FFT is still in-place on the second buffer, this is here just for convenience.
@@ -1776,7 +1776,6 @@ static VkResult launchResample(VkResampleConfiguration config) {
17761776
vkDestroyDevice(vkGPU.device, NULL);
17771777
DestroyDebugUtilsMessengerEXT(&vkGPU, NULL);
17781778
vkDestroyInstance(vkGPU.instance, NULL);
1779-
glslang_finalize_process();//destroy compiler after use
17801779
return VK_SUCCESS;
17811780
}
17821781

@@ -1806,12 +1805,12 @@ int main(int argc, char* argv[])
18061805
if (findFlag(argv, argv + argc, "-h"))
18071806
{
18081807
//print help
1809-
printf("VkResample v1.0.1 (14-01-2021). Author: Tolmachev Dmitrii\n");
1808+
printf("VkResample v1.0.2 (16-01-2021). Author: Tolmachev Dmitrii\n");
18101809
printf("Works with png images only, for now!\n");
18111810
printf(" -h: print help\n");
18121811
printf(" -devices: print the list of available GPU devices\n");
18131812
printf(" -d X: select GPU device (default 0)\n");
1814-
printf(" -u X: specify upscale factor (float, make sure that upscaled image can be represented as a multiplication of 2s, 3s and 5s)\n");
1813+
printf(" -u X: specify upscale factor (float, make sure that upscaled image can be represented as a multiplication of 2s, 3s, 5s and 7s)\n");
18151814
printf(" -p X: specify precision (0 - single, 1 - double, 2 - half, default - single)\n");
18161815
printf(" -s X: specify sharpening factor, range 0.0-0.2 (default 0.2) \n");
18171816
printf(" -n X: specify how many times to perform upscale. This removes dispatch overhead and will show the real application performance (default 1)\n");
@@ -1825,6 +1824,7 @@ int main(int argc, char* argv[])
18251824
printf(" -numthreads X: specify how many threads to launch. Used to speed up png reads\n");
18261825
return 0;
18271826
}
1827+
glslang_initialize_process();//compiler can be initialized before VkFFT
18281828
if (findFlag(argv, argv + argc, "-devices"))
18291829
{
18301830
//print device list
@@ -1971,6 +1971,7 @@ int main(int argc, char* argv[])
19711971
auto timeEnd = std::chrono::system_clock::now();
19721972
double totTime = std::chrono::duration_cast<std::chrono::microseconds>(timeEnd - timeSubmit).count() * 0.001;
19731973
printf("Total time: %0.3f s\n", totTime/1000);
1974+
glslang_finalize_process();//destroy compiler after use
19741975
return VK_SUCCESS;
19751976

19761977
}

0 commit comments

Comments
 (0)