Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load bin in a single pass #4966

Merged
merged 1 commit into from
Aug 22, 2023
Merged
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
29 changes: 12 additions & 17 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,18 @@ int Net::load_model(const DataReader& dr)
// load file
int ret = 0;

#if NCNN_VULKAN
if (opt.use_vulkan_compute)
{
if (!opt.pipeline_cache)
{
if (!d->pipeline_cache)
d->pipeline_cache = new PipelineCache(d->vkdev);
opt.pipeline_cache = d->pipeline_cache;
}
}
#endif // NCNN_VULKAN

ModelBinFromDataReader mb(dr);
for (int i = 0; i < layer_count; i++)
{
Expand Down Expand Up @@ -1765,23 +1777,6 @@ int Net::load_model(const DataReader& dr)
// no int8 gpu support yet
opt.use_vulkan_compute = false;
}
}

#if NCNN_VULKAN
if (opt.use_vulkan_compute)
{
if (!opt.pipeline_cache)
{
if (!d->pipeline_cache)
d->pipeline_cache = new PipelineCache(d->vkdev);
opt.pipeline_cache = d->pipeline_cache;
}
}
#endif // NCNN_VULKAN

for (int i = 0; i < layer_count; i++)
{
Layer* layer = d->layers[i];

Option opt1 = get_masked_option(opt, layer->featmask);
#if NCNN_VULKAN
Expand Down
Loading