Skip to content
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

CAD emulated float64 #114

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
eaff54a
Added tests for emulated_float64_t
Przemog1 May 10, 2024
1abd122
Implemented emulated float64 type
Przemog1 May 13, 2024
0307779
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 May 15, 2024
2e00f20
Added emulated float64 test
Przemog1 May 15, 2024
2ad6a6c
Fixed GPU values test
Przemog1 May 16, 2024
ea4fbbf
Saving work
Przemog1 May 23, 2024
2a878a0
Created emulated_float64_t tests
Przemog1 May 27, 2024
1169a13
Implemented add sub i mul operators
Przemog1 May 31, 2024
2d5d301
Adjusted tests
Przemog1 Jun 5, 2024
f17208a
Saving work
Przemog1 Jun 18, 2024
85babd0
Added more tests
Przemog1 Jul 8, 2024
5aaabfd
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Jul 9, 2024
25dfb67
Saving work
Przemog1 Jul 24, 2024
c53f5c8
Updated tests
Przemog1 Jul 30, 2024
822446f
Refactorization
Przemog1 Jul 31, 2024
deaa9f2
Fixes
Przemog1 Jul 31, 2024
f99b039
Revived GPU tests
Przemog1 Aug 1, 2024
54cf5e9
Saving work
Przemog1 Aug 6, 2024
10605e9
Resolved conflicts, merged master
Przemog1 Aug 6, 2024
aefcde9
Saving work
Przemog1 Aug 7, 2024
9b1edf6
Saving work
Przemog1 Aug 13, 2024
8e853f5
No Float64 cap
Przemog1 Aug 20, 2024
0bfc208
Refactor
Przemog1 Aug 22, 2024
293ec73
Saving work
Przemog1 Aug 23, 2024
b6b11ae
Saving work
Przemog1 Aug 24, 2024
dc10103
Implemented casting functions for emulated_float64_t
Przemog1 Aug 26, 2024
912f012
Updated tests
Przemog1 Aug 27, 2024
da25126
Fixes
Przemog1 Aug 28, 2024
70ee941
Fixed shaders so they compile even if portable_float64_t is not emulated
Przemog1 Aug 28, 2024
c08cd35
Saving work
Przemog1 Aug 29, 2024
a6b14da
Updated examples
Przemog1 Aug 30, 2024
f8f2c23
Fixed a bug
Przemog1 Sep 3, 2024
a9e1007
Reduced branches in operator+
Przemog1 Sep 3, 2024
1750aef
Enhanced more tests, more fixes
Przemog1 Sep 6, 2024
5e47cf3
Added example 64
Przemog1 Sep 6, 2024
48b4a40
Removed emulated float tests from example 22
Przemog1 Sep 6, 2024
904da40
64 bit float type is now determined by device capabilities
Przemog1 Sep 13, 2024
d6f0c58
Refactor
Przemog1 Sep 13, 2024
7f7b485
More refactor
Przemog1 Sep 13, 2024
cdafbbc
Fixes
Przemog1 Sep 21, 2024
aebab4a
More fixes
Przemog1 Sep 23, 2024
62f8a54
Even more fixes
Przemog1 Sep 25, 2024
8c873fa
Added more tests
Przemog1 Sep 28, 2024
af5ae27
Minor tests improvement
Przemog1 Sep 28, 2024
846e7aa
Resolved conflicts, merged master
Przemog1 Sep 28, 2024
a4fe41d
Added ef64_benchmark
Przemog1 Sep 28, 2024
ca02166
Tests works
Przemog1 Oct 1, 2024
843ee6a
Saving work
Przemog1 Oct 2, 2024
7422248
Saving work
Przemog1 Oct 2, 2024
6915664
Benchmark works
Przemog1 Oct 4, 2024
582f002
Saving work
Przemog1 Oct 4, 2024
8c37152
Improved benchmark
Przemog1 Oct 5, 2024
3912137
Added more benchmarks
Przemog1 Oct 7, 2024
031b1bc
Saving old version
Przemog1 Oct 7, 2024
239b3b0
Refactored example 64
Przemog1 Oct 7, 2024
0b39d2d
Saving work
Przemog1 Oct 8, 2024
879860a
Resolved conflicts, merged emulated_float64_t
Przemog1 Oct 9, 2024
3c063f8
Fixed benchmarks
Przemog1 Oct 9, 2024
ac97c37
Corrections
Przemog1 Oct 9, 2024
38282a3
Fix
Przemog1 Oct 10, 2024
b5cb225
Merge pull request #150 from Devsh-Graphics-Programming/ef64_benchmark
Przemog1 Oct 10, 2024
fa5a77b
Updated example 64
Przemog1 Oct 10, 2024
6dbde45
Fixed benchmark
Przemog1 Oct 11, 2024
5bd5c02
Fixed _static_cast
Przemog1 Oct 15, 2024
e4a42f4
Updated example
Przemog1 Oct 15, 2024
a80dcf8
Merge branch 'master' of https://github.com/Devsh-Graphics-Programmin…
Przemog1 Oct 21, 2024
44aec1e
Merge branch 'master' into emulated_float64_t
Erfan-Ahmadi Oct 25, 2024
aff6223
Fixes after Resolving Shader Conflicts
Erfan-Ahmadi Oct 25, 2024
b4ad0b6
Resolved conflicts, merged master
Przemog1 Nov 20, 2024
ad0e24f
Implemented nbl::hlsl::mul
Przemog1 Nov 26, 2024
d62f779
Fixed array_get and array_set
Przemog1 Nov 26, 2024
ce7e866
Saving work
Przemog1 Dec 1, 2024
cee85d1
Refactor
Przemog1 Dec 4, 2024
a8a7802
Saving work
Przemog1 Dec 6, 2024
68d9ea0
Improvements
Przemog1 Dec 7, 2024
84906bb
Refactor
Przemog1 Dec 9, 2024
a7d1600
Fixes
Przemog1 Dec 11, 2024
6fec756
Merge branch 'cpp_compat_intrinsics_refactor' of github.com:Devsh-Gra…
Przemog1 Dec 12, 2024
4c58e03
Saving work
Przemog1 Dec 13, 2024
73ac5c8
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla-…
Przemog1 Dec 16, 2024
01b05ce
Merge branch 'cpp_compat_intrinsics_refactor' of github.com:Devsh-Gra…
Przemog1 Dec 17, 2024
1d133bb
Saving work
Przemog1 Dec 18, 2024
9649fda
Fixes
Przemog1 Dec 19, 2024
383fb3c
Merge branch 'ef64_t' into emulated_float64_t
Przemog1 Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma wave shader_stage(compute)
#include "common.hlsl"
#include <nbl/builtin/hlsl/emulated_float64_t.hlsl>

[numthreads(256,1,1)]
void main()
{
const emulated::float64_t a = _static_cast<emulated::float64_t>(6.9f);
const emulated::float64_t b = _static_cast<emulated::float64_t>(4.5f);

vk::RawBufferStore<emulated::float64_t::storage_t>(0,(a*b).data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umm this is unsafe, you're writing to gpu virtual address of 0u, you might crash. you create a buffer and pass the address via push constant

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it kinda looks like a file someone forgot to remove (no chanes in 03 main.cpp)


const float asdf = 1.0f;
const float asdff = 1.0f;
}
42 changes: 42 additions & 0 deletions 22_CppCompat/app_resources/emulated_float64_t_test/common.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h

#include <nbl/builtin/hlsl/cpp_compat.hlsl>
#include <nbl/builtin/hlsl/emulated_float64_t.hlsl>

NBL_CONSTEXPR uint32_t WORKGROUP_SIZE = 1;

struct TestValues
{
// "constructors"
emulated::emulated_float64_t::storage_t intCreateVal;
emulated::emulated_float64_t::storage_t uintCreateVal;
emulated::emulated_float64_t::storage_t uint64CreateVal;
emulated::emulated_float64_t::storage_t floatCreateVal;
emulated::emulated_float64_t::storage_t doubleCreateVal;
//emulated::emulated_float64_t::create(min16int(2));

// arithmetic
emulated::emulated_float64_t::storage_t additionVal;
emulated::emulated_float64_t::storage_t substractionVal;
emulated::emulated_float64_t::storage_t multiplicationVal;
emulated::emulated_float64_t::storage_t divisionVal;

// relational
int lessOrEqualVal;
int greaterOrEqualVal;
int equalVal;
int notEqualVal;
int lessVal;
int greaterVal;

// conversion
int convertionToBoolVal;
int convertionToIntVal;
uint32_t convertionToUint32Val;
uint64_t convertionToUint64Val;
float convertionToFloatVal;
double convertionToDoubleVal;
//bool convertionToHalfVal;
};
46 changes: 46 additions & 0 deletions 22_CppCompat/app_resources/emulated_float64_t_test/test.comp.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//// Copyright (C) 2023-2024 - DevSH Graphics Programming Sp. z O.O.
//// This file is part of the "Nabla Engine".
//// For conditions of distribution and use, see copyright notice in nabla.h
#pragma shader_stage(compute)

#include "app_resources/emulated_float64_t_test/common.hlsl"

[[vk::binding(0, 0)]] RWStructuredBuffer<TestValues> testValuesOutput;

[numthreads(WORKGROUP_SIZE, 1, 1)]
void main(uint3 invocationID : SV_DispatchThreadID)
{
const emulated::emulated_float64_t a = emulated::emulated_float64_t::create(20.0);
const emulated::emulated_float64_t b = emulated::emulated_float64_t::create(10.0);

// "constructors"
//testValuesOutput[0].intCreateVal = emulated::emulated_float64_t::create(24);
//testValuesOutput[0].uintCreateVal = emulated::emulated_float64_t::create(24u);
//testValuesOutput[0].uint64CreateVal = emulated::emulated_float64_t::create(24ull);
//testValuesOutput[0].floatCreateVal = emulated::emulated_float64_t::create(1.2f);
//testValuesOutput[0].doubleCreateVal = emulated::emulated_float64_t::create(1.2);
emulated::emulated_float64_t::create(min16int(2));

// arithmetic operators
testValuesOutput[0].additionVal = (a+b).data;
testValuesOutput[0].substractionVal = (a-b).data;
testValuesOutput[0].multiplicationVal = (a*b).data;
testValuesOutput[0].divisionVal = (a/b).data;

// relational operators
testValuesOutput[0].lessOrEqualVal = (a<=b);
testValuesOutput[0].greaterOrEqualVal = (a>=b);
testValuesOutput[0].equalVal = (a==b);
testValuesOutput[0].notEqualVal = (a!=b);
testValuesOutput[0].lessVal = (a<b);
testValuesOutput[0].greaterVal = (a>b);

// conversion operators
testValuesOutput[0].convertionToBoolVal = bool(a);
testValuesOutput[0].convertionToIntVal = int(a);
testValuesOutput[0].convertionToUint32Val = uint32_t(a);
testValuesOutput[0].convertionToUint64Val = uint64_t(a);
testValuesOutput[0].convertionToFloatVal = float(a);
testValuesOutput[0].convertionToDoubleVal = float64_t(a);
//testValuesOutput[0].convertionToHalfVal = half(a);
}
Loading