Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 26 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"cogentcore.org/core/content"
"cogentcore.org/core/core"
"cogentcore.org/core/htmlcore"
"cogentcore.org/core/icons"
"cogentcore.org/core/tree"
_ "cogentcore.org/lab/yaegilab"
)

Expand All @@ -22,7 +24,30 @@ func main() {
ctx := ct.Context
ctx.AddWikilinkHandler(htmlcore.GoDocWikilink("doc", "cogentcore.org/lab"))
b.AddTopBar(func(bar *core.Frame) {
core.NewToolbar(bar).Maker(ct.MakeToolbar)
tb := core.NewToolbar(bar)
tb.Maker(ct.MakeToolbar)
tb.Maker(func(p *tree.Plan) {
tree.Add(p, func(w *core.Button) {
ctx.LinkButton(w, "https://github.com/cogentcore/lab")
w.SetText("GitHub").SetIcon(icons.GitHub)
})
tree.Add(p, func(w *core.Button) {
ctx.LinkButton(w, "https://youtube.com/@CogentCore")
w.SetText("Videos").SetIcon(icons.VideoLibrary)
})
tree.Add(p, func(w *core.Button) {
ctx.LinkButton(w, "https://cogentcore.org/blog")
w.SetText("Blog").SetIcon(icons.RssFeed)
})
tree.Add(p, func(w *core.Button) {
ctx.LinkButton(w, "https://cogentcore.org/community")
w.SetText("Community").SetIcon(icons.Forum)
})
tree.Add(p, func(w *core.Button) {
ctx.LinkButton(w, "https://github.com/sponsors/cogentcore")
w.SetText("Sponsor").SetIcon(icons.Favorite)
})
})
})
b.RunMainWindow()
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go 1.23.4
// https://github.com/googleapis/go-genproto/issues/1015

require (
cogentcore.org/core v0.3.12-0.20250709004609-fcc0ceae20b3
cogentcore.org/core v0.3.12-0.20250713173440-f149032010b2
github.com/cogentcore/readline v0.1.3
github.com/cogentcore/yaegi v0.0.0-20250622201820-b7838bdd95eb
github.com/mitchellh/go-homedir v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cogentcore.org/core v0.3.12-0.20250709004609-fcc0ceae20b3 h1:5rnkjHt+D9iQKjEhpgkc2FH5E/biP88BOS0mq2Jb0hw=
cogentcore.org/core v0.3.12-0.20250709004609-fcc0ceae20b3/go.mod h1:1C0LnfjobosaRX6VqVz6O+ZJ6k85su3Ixx1FQPHSHIk=
cogentcore.org/core v0.3.12-0.20250713173440-f149032010b2 h1:gfYx/AZoN4ixjoGhFXXJU2VmqJPuFfvwRcStHtRNVvI=
cogentcore.org/core v0.3.12-0.20250713173440-f149032010b2/go.mod h1:1C0LnfjobosaRX6VqVz6O+ZJ6k85su3Ixx1FQPHSHIk=
github.com/Bios-Marcel/wastebasket/v2 v2.0.3 h1:TkoDPcSqluhLGE+EssHu7UGmLgUEkWg7kNyHyyJ3Q9g=
github.com/Bios-Marcel/wastebasket/v2 v2.0.3/go.mod h1:769oPCv6eH7ugl90DYIsWwjZh4hgNmMS3Zuhe1bH6KU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down
18 changes: 16 additions & 2 deletions gosl/examples/basic/gosl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

198 changes: 0 additions & 198 deletions gosl/examples/basic/shaders/Atomic.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,7 @@
// // Params are the parameters for the computation. //
@group(0) @binding(0)
var<storage, read> TensorStrides: array<u32>;
@group(0) @binding(1)
var<storage, read> Params: array<ParamStruct>;
// // Data is the data on which the computation operates. // 2D: outer index is data, inner index is: Raw, Integ, Exp vars. //
@group(1) @binding(0)
var<storage, read_write> Data0: array<f32>;
@group(1) @binding(1)
var<storage, read_write> Data1: array<f32>;
@group(1) @binding(2)
var<storage, read_write> Data2: array<f32>;
@group(1) @binding(3)
var<storage, read_write> Data3: array<f32>;
@group(1) @binding(4)
var<storage, read_write> Data4: array<f32>;
@group(1) @binding(5)
var<storage, read_write> Data5: array<f32>;
@group(1) @binding(6)
var<storage, read_write> Data6: array<f32>;
@group(1) @binding(7)
var<storage, read_write> Data7: array<f32>;
@group(1) @binding(8)
var<storage, read_write> IntData: array<atomic<i32>>;

Expand All @@ -34,186 +16,6 @@ fn main(@builtin(workgroup_id) wgid: vec3<u32>, @builtin(num_workgroups) nwg: ve
Atomic(idx);
}

fn DataGet(ix: u32) -> f32 {
let ii = ix / 536870912;
switch ii {
case u32(0): {
return Data0[ix];
}
case u32(1): {
return Data1[ix - 536870912];
}
case u32(2): {
return Data2[ix - 1073741824];
}
case u32(3): {
return Data3[ix - 1610612736];
}
case u32(4): {
return Data4[ix - 2147483648];
}
case u32(5): {
return Data5[ix - 2684354560];
}
case u32(6): {
return Data6[ix - 3221225472];
}
default: {
return Data7[ix - 3758096384];
}
}
}

fn DataSet(vl: f32, ix: u32) {
let ii = ix / 536870912;
switch ii {
case u32(0): {
Data0[ix] = vl;
}
case u32(1): {
Data1[ix - 536870912] = vl;
}
case u32(2): {
Data2[ix - 1073741824] = vl;
}
case u32(3): {
Data3[ix - 1610612736] = vl;
}
case u32(4): {
Data4[ix - 2147483648] = vl;
}
case u32(5): {
Data5[ix - 2684354560] = vl;
}
case u32(6): {
Data6[ix - 3221225472] = vl;
}
default: {
Data7[ix - 3758096384] = vl;
}
}
}

fn DataSetAdd(vl: f32, ix: u32) {
let ii = ix / 536870912;
switch ii {
case u32(0): {
Data0[ix] += vl;
}
case u32(1): {
Data1[ix - 536870912] += vl;
}
case u32(2): {
Data2[ix - 1073741824] += vl;
}
case u32(3): {
Data3[ix - 1610612736] += vl;
}
case u32(4): {
Data4[ix - 2147483648] += vl;
}
case u32(5): {
Data5[ix - 2684354560] += vl;
}
case u32(6): {
Data6[ix - 3221225472] += vl;
}
default: {
Data7[ix - 3758096384] += vl;
}
}
}

fn DataSetSub(vl: f32, ix: u32) {
let ii = ix / 536870912;
switch ii {
case u32(0): {
Data0[ix] -= vl;
}
case u32(1): {
Data1[ix - 536870912] -= vl;
}
case u32(2): {
Data2[ix - 1073741824] -= vl;
}
case u32(3): {
Data3[ix - 1610612736] -= vl;
}
case u32(4): {
Data4[ix - 2147483648] -= vl;
}
case u32(5): {
Data5[ix - 2684354560] -= vl;
}
case u32(6): {
Data6[ix - 3221225472] -= vl;
}
default: {
Data7[ix - 3758096384] -= vl;
}
}
}

fn DataSetMul(vl: f32, ix: u32) {
let ii = ix / 536870912;
switch ii {
case u32(0): {
Data0[ix] *= vl;
}
case u32(1): {
Data1[ix - 536870912] *= vl;
}
case u32(2): {
Data2[ix - 1073741824] *= vl;
}
case u32(3): {
Data3[ix - 1610612736] *= vl;
}
case u32(4): {
Data4[ix - 2147483648] *= vl;
}
case u32(5): {
Data5[ix - 2684354560] *= vl;
}
case u32(6): {
Data6[ix - 3221225472] *= vl;
}
default: {
Data7[ix - 3758096384] *= vl;
}
}
}

fn DataSetDiv(vl: f32, ix: u32) {
let ii = ix / 536870912;
switch ii {
case u32(0): {
Data0[ix] /= vl;
}
case u32(1): {
Data1[ix - 536870912] /= vl;
}
case u32(2): {
Data2[ix - 1073741824] /= vl;
}
case u32(3): {
Data3[ix - 1610612736] /= vl;
}
case u32(4): {
Data4[ix - 2147483648] /= vl;
}
case u32(5): {
Data5[ix - 2684354560] /= vl;
}
case u32(6): {
Data6[ix - 3221225472] /= vl;
}
default: {
Data7[ix - 3758096384] /= vl;
}
}
}

fn Index2D(s0: u32, s1: u32, i0: u32, i1: u32) -> u32 {
return s0 * i0 + s1 * i1;
}
Expand Down
2 changes: 0 additions & 2 deletions gosl/examples/basic/shaders/Compute.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ var<storage, read_write> Data5: array<f32>;
var<storage, read_write> Data6: array<f32>;
@group(1) @binding(7)
var<storage, read_write> Data7: array<f32>;
@group(1) @binding(8)
var<storage, read_write> IntData: array<i32>;

alias GPUVars = i32;

Expand Down
21 changes: 15 additions & 6 deletions gosl/examples/rand/gosl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading