Files
Graphite/node-graph/gpu-compiler/src/templates/spirv-template.rs
Dennis Kobert 3c2d371173 Graphene CLI + quantization research (#1320)
* Implement skeleton for graphene-cli

* Configure gpu surface on non wasm32 targets

* Create window with full hd size

* Create window using the graphen-cli

* Use window size for surface creation

* Reuse surface configuration

* Reduce window size for native applications to 800x600

* Add compute pipeline test

* Poll wgpu execution externally

* Remove cache node after texture upload

* Add profiling instructions

* Add more debug markers

* Evaluate extract node before flattening the network

* Reenable hue saturation node for compilation

* Make hue saturation node work on the gpu + make f32 default for user inputs

* Add version of test files without caching

* Only dispatch each workgroup not pixel

* ICE

* Add quantization to gpu code

* Fix quantization

* Load images at graph runtime

* Fix quantization calculation

* Feature gate quantization

* Use git version of autoquant

* Add license to `graphene-cli`

* Fix graphene-cli test case

* Ignore tests on non unix platforms

* Fix flattening test
2023-07-04 17:04:09 +02:00

43 lines
1.2 KiB
Rust

#![no_std]
#![feature(unchecked_math)]
#[cfg(target_arch = "spirv")]
extern crate spirv_std;
//#[cfg(target_arch = "spirv")]
//pub mod gpu {
//use super::*;
use spirv_std::spirv;
use spirv_std::glam;
use spirv_std::glam::{UVec3, Vec2, Mat2, BVec2};
#[allow(unused)]
#[spirv(compute(threads({{compute_threads}})))]
pub fn eval (
#[spirv(global_invocation_id)] _global_index: UVec3,
{% for input in inputs %}
{{input}},
{% endfor %}
) {
use graphene_core::{Node, NodeMut};
use graphene_core::raster::adjustments::{BlendMode, BlendNode};
use graphene_core::Color;
{% for input in input_nodes %}
let _i{{input.index}} = graphene_core::value::CopiedNode::new(*i{{input.index}});
let _{{input.id}} = {{input.fqn}}::new({% for arg in input.args %}{{arg}}, {% endfor %});
let {{input.id}} = graphene_core::structural::ComposeNode::new(_i{{input.index}}, _{{input.id}});
{% endfor %}
{% for node in nodes %}
let mut {{node.id}} = {{node.fqn}}::new({% for arg in node.args %}{{arg}}, {% endfor %});
{% endfor %}
{% for output in output_nodes %}
let v = {{output}}.eval(());
o{{loop.index0}}[(_global_index.y * i0 + _global_index.x) as usize] = v;
{% endfor %}
// TODO: Write output to buffer
}
//}