Browse Source

load bin in a single pass (#4966)

Signed-off-by: daquexian <daquexian566@gmail.com>
tags/20231027
daquexian GitHub 2 years ago
parent
commit
d38871bbfc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 17 deletions
  1. +12
    -17
      src/net.cpp

+ 12
- 17
src/net.cpp View File

@@ -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++)
{
@@ -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


Loading…
Cancel
Save