@@ -15,20 +15,23 @@ namespace workgroup2
15
15
16
16
namespace impl
17
17
{
18
- template<uint16_t WorkgroupSizeLog2 , uint16_t SubgroupSizeLog2 >
18
+ template<uint16_t _WorkgroupSizeLog2 , uint16_t _SubgroupSizeLog2 >
19
19
struct virtual_wg_size_log2
20
20
{
21
+ NBL_CONSTEXPR_STATIC_INLINE uint16_t WorkgroupSizeLog2 = _WorkgroupSizeLog2;
22
+ NBL_CONSTEXPR_STATIC_INLINE uint16_t SubgroupSizeLog2 = _SubgroupSizeLog2;
21
23
static_assert (WorkgroupSizeLog2>=SubgroupSizeLog2, "WorkgroupSize cannot be smaller than SubgroupSize" );
22
24
static_assert (WorkgroupSizeLog2<=SubgroupSizeLog2*3 +4 , "WorkgroupSize cannot be larger than (SubgroupSize^3)*16" );
25
+
23
26
NBL_CONSTEXPR_STATIC_INLINE uint16_t levels = conditional_value<(WorkgroupSizeLog2>SubgroupSizeLog2),uint16_t,conditional_value<(WorkgroupSizeLog2>SubgroupSizeLog2*2 +2 ),uint16_t,3 ,2 >::value,1 >::value;
24
27
NBL_CONSTEXPR_STATIC_INLINE uint16_t value = mpl::max_v<uint32_t, SubgroupSizeLog2*levels, WorkgroupSizeLog2>;
25
28
// must have at least enough level 0 outputs to feed a single subgroup
26
29
};
27
30
28
- template<class VirtualWorkgroup, uint16_t BaseItemsPerInvocation, uint16_t WorkgroupSizeLog2, uint16_t SubgroupSizeLog2 >
31
+ template<class VirtualWorkgroup, uint16_t BaseItemsPerInvocation>
29
32
struct items_per_invocation
30
33
{
31
- NBL_CONSTEXPR_STATIC_INLINE uint16_t ItemsPerInvocationProductLog2 = mpl::max_v<int16_t,WorkgroupSizeLog2-SubgroupSizeLog2*VirtualWorkgroup::levels,0 >;
34
+ NBL_CONSTEXPR_STATIC_INLINE uint16_t ItemsPerInvocationProductLog2 = mpl::max_v<int16_t,VirtualWorkgroup:: WorkgroupSizeLog2-VirtualWorkgroup:: SubgroupSizeLog2*VirtualWorkgroup::levels,0 >;
32
35
NBL_CONSTEXPR_STATIC_INLINE uint16_t value0 = BaseItemsPerInvocation;
33
36
NBL_CONSTEXPR_STATIC_INLINE uint16_t value1 = uint16_t (0x1u) << conditional_value<VirtualWorkgroup::levels==3 , uint16_t,mpl::min_v<uint16_t,ItemsPerInvocationProductLog2,2 >, ItemsPerInvocationProductLog2>::value;
34
37
NBL_CONSTEXPR_STATIC_INLINE uint16_t value2 = uint16_t (0x1u) << mpl::max_v<int16_t,ItemsPerInvocationProductLog2-2 ,0 >;
@@ -51,7 +54,7 @@ struct ArithmeticConfiguration
51
54
NBL_CONSTEXPR_STATIC_INLINE uint16_t __SubgroupsPerVirtualWorkgroupLog2 = mpl::max_v<uint16_t, WorkgroupSizeLog2-SubgroupSizeLog2, SubgroupSizeLog2>;
52
55
NBL_CONSTEXPR_STATIC_INLINE uint16_t __SubgroupsPerVirtualWorkgroup = uint16_t (0x1u) << __SubgroupsPerVirtualWorkgroupLog2;
53
56
54
- using items_per_invoc_t = impl::items_per_invocation<virtual_wg_t, _ItemsPerInvocation, WorkgroupSizeLog2, SubgroupSizeLog2 >;
57
+ using items_per_invoc_t = impl::items_per_invocation<virtual_wg_t, _ItemsPerInvocation>;
55
58
// NBL_CONSTEXPR_STATIC_INLINE uint32_t2 ItemsPerInvocation; TODO? doesn't allow inline definitions for uint32_t2 for some reason, uint32_t[2] as well ; declaring out of line results in not constant expression
56
59
NBL_CONSTEXPR_STATIC_INLINE uint16_t ItemsPerInvocation_0 = items_per_invoc_t::value0;
57
60
NBL_CONSTEXPR_STATIC_INLINE uint16_t ItemsPerInvocation_1 = items_per_invoc_t::value1;
0 commit comments