Skip to content

Commit

Permalink
load bin in a single pass (#4966)
Browse files Browse the repository at this point in the history
Signed-off-by: daquexian <daquexian566@gmail.com>
  • Loading branch information
daquexian authored Aug 22, 2023
1 parent cb674ac commit d38871b
Showing 1 changed file with 12 additions and 17 deletions.
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

0 comments on commit d38871b

Please sign in to comment.