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
7 changes: 6 additions & 1 deletion clean/dx12/tests/native_direct_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def main():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('--out', required=True)
p.add_argument('--rocm', default=r'C:\Program Files\AMD\ROCm\7.2')
p.add_argument('--model-l', action='store_true',
help='also Model L (WG_MODEL_L, clean/l/runtime): the test then runs it with its last argument L')
a = p.parse_args()
clean = Path(__file__).resolve().parents[2]
rt = clean / 'runtime'
Expand All @@ -27,11 +29,14 @@ def main():
src += [rt / s for s in ('device.cpp', 'device_dx12.cpp', 'device_d3d12.cpp', 'embedded.cpp', 'model.cpp', 'no_model_k.cpp',
'runtime.cpp', 'interop/convert.cpp', 'interop/native_candidate.cpp')]
src += [clean / 'converter/src' / s for s in ('json.cpp', 'sha256.cpp')]
if a.model_l:
src += [clean / 'l/runtime' / s for s in ('l_model.cpp', 'l_pack.cpp')]
exe = out / 'native_direct_test.exe'
if exe.exists():
p.error('output executable already exists; select a new private build directory')
cmd = [str(Path(a.rocm) / 'bin/clang++.exe'), '-std=c++17', '-O2', '-D_CRT_SECURE_NO_WARNINGS',
'-DWG_NO_MODEL_K', '-fms-runtime-lib=static', *map(str, src), '-o', str(exe)]
'-DWG_NO_MODEL_K', *(['-DWG_MODEL_L'] if a.model_l else []), '-fms-runtime-lib=static', *map(str, src),
'-o', str(exe)]
dependencies=src+[rt/s for s in ('device.h','device_d3d12.h','runtime_core.h','wg_runtime.h','model.h','embedded.h',
'interop/native_candidate.h','interop/convert.h','interop/d3d12_include.h')]
dependencies += [clean/'fsr/include/wronggpu_upscaler.h']
Expand Down
11 changes: 8 additions & 3 deletions clean/dx12/tests/native_direct_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ int main(int argc,char** argv){
int frames=argc>9?std::stoi(argv[9]):8,cycles=argc>10?std::stoi(argv[10]):2;
double warm=argc>11?std::stod(argv[11]):3;int rounds=argc>12?std::stoi(argv[12]):3,samples=argc>13?std::stoi(argv[13]):600;
double minimum_seconds=argc>14?std::stod(argv[14]):1;std::string pre_exposure=argc>15?argv[15]:"scale";int hdr=argc>16?std::stoi(argv[16]):0;
// argument 17: the model, M (default) or L (a build with WG_MODEL_L: <model>/L/model.wgcm, its map
// preset-L.v1.map.json in the build folder; Model L's file has no output-filter weights: the analytic filter)
const std::string model_id=argc>17?argv[17]:"M";
need(model_id=="M"||model_id=="L","model must be M or L");
need(std::isfinite(minimum_seconds)&&minimum_seconds>=1,"minimum measurement window must be >=1 second");
need((pre_exposure=="scale"||pre_exposure=="original")&&(hdr==0||hdr==1),"pre-exposure/HDR options");
need(rw>0&&rh>0&&ow>0&&oh>0&&frames>0&&cycles>0,"positive test sizes/counts");
Expand All @@ -394,11 +398,12 @@ int main(int argc,char** argv){
_putenv_s("WG_DX12_DEBUG",mode!="bench"&&g.iq?"1":"");
modules("fresh",true);
WgRtConfig cfg={};cfg.build_dir=build.c_str();cfg.model_dir=model.c_str();cfg.backend=3;cfg.max_rw=rw;cfg.max_rh=rh;
cfg.ow=ow;cfg.oh=oh;cfg.depth_inverted=1;cfg.auto_exposure=1;cfg.model_format=1;
std::string options="model=M;output_filter=original;pre_exposure="+pre_exposure;
cfg.ow=ow;cfg.oh=oh;cfg.depth_inverted=1;cfg.auto_exposure=1;cfg.model_format=model_id=="L"?0:1;
std::string options=model_id=="L"?"model=L;pre_exposure="+pre_exposure
:"model=M;output_filter=original;pre_exposure="+pre_exposure;
cfg.runtime_options=options.c_str();cfg.hdr=hdr;
const uint32_t flags=WG_CREATE_DEPTH_INVERTED|WG_CREATE_AUTO_EXPOSURE|(hdr?WG_CREATE_HDR:0);
std::printf("OPTIONS pre_exposure=%s hdr=%d\n",pre_exposure.c_str(),hdr);
std::printf("OPTIONS pre_exposure=%s hdr=%d model=%s\n",pre_exposure.c_str(),hdr,model_id.c_str());
bool mutation=false;unsigned compared=0,combinations=0;
for(int cycle=0;cycle<(mode=="bench"?1:cycles);++cycle){
auto direct=wgi::NativeCandidate::create(g.d,g.q,cfg,flags,&e,true);need(!!direct,e);
Expand Down
6 changes: 5 additions & 1 deletion clean/runtime/interop/native_candidate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ bool NativeCandidate::dispatch(const WgFrame& f,ID3D12Fence* ready,uint64_t valu
return true;
}
bool NativeCandidate::sync(std::string* e){return p_->sync(e);}
const char* NativeCandidate::provider()const{return p_->direct_resources?
const char* NativeCandidate::provider()const{
// the model the runtime runs (runtime_model: "M", or "L" with the runtime option model=L in builds with Model L)
if(p_->rt&&std::strcmp(wgrt::runtime_model(p_->rt),"L")==0)return p_->direct_resources?
"Model L native D3D12, supplied device/queue, direct textures":"Model L native D3D12, supplied device/queue, staged reference";
return p_->direct_resources?
"Model M native D3D12, supplied device/queue, direct textures":"Model M native D3D12, supplied device/queue, staged reference";}
const NativeFrameInventory& NativeCandidate::last_frame_inventory()const{return p_->inventory;}
bool NativeCandidate::read_buffer(const char* name,std::vector<unsigned char>* bytes,std::string* e) {
Expand Down
Loading