interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / om / codegen / cg_budget.om

17 lines · 408 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Declared GPR launch budget. Zero result refuses budget; all-ones refuses zero threads.
3fn cg_budget peak ulong decl ulong threads ulong to ulong
4if eq threads 0
5ret 18446744073709551615
6end
7if lt decl 64
8decl = ulong 64
9end
10if or gt peak 128 or ne rem decl 8 0 lt decl add peak 2
11ret 0
12end
13if gt mul decl threads 65536
14ret 0
15end
16ret decl
17end