Kernels: Bugfix with large temporary sizes
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "isaac/kernels/templates/base.h"
|
||||
#include "isaac/kernels/parse.h"
|
||||
#include "isaac/exception/unknown_datatype.h"
|
||||
#include "isaac/exception/operation_not_supported.h"
|
||||
#include "isaac/symbolic/io.h"
|
||||
|
||||
#include "tools/map.hpp"
|
||||
@@ -83,6 +84,10 @@ std::string base::generate(std::string const & suffix, expressions_tuple const &
|
||||
expressions_tuple::data_type::const_iterator sit;
|
||||
std::vector<mapping_type>::iterator mit;
|
||||
|
||||
int err = is_invalid(expressions, device);
|
||||
if(err != 0)
|
||||
throw operation_not_supported_exception("The supplied parameters for this template are invalid : err " + tools::to_string(err));
|
||||
|
||||
//Create mapping
|
||||
std::vector<mapping_type> mappings(expressions.data().size());
|
||||
std::unique_ptr<symbolic_binder> binder;
|
||||
@@ -141,10 +146,6 @@ int base_impl<TType, PType>::is_invalid(expressions_tuple const & expressions, d
|
||||
if (p_.simd_width!=1 && p_.simd_width!=2 && p_.simd_width!=3 && p_.simd_width!=4)
|
||||
return TEMPLATE_INVALID_SIMD_WIDTH;
|
||||
|
||||
//Temporary workspace
|
||||
if(temporary_workspace(expressions) > 2e6)
|
||||
return TEMPLATE_TEMPORARY_TOO_LARGE;
|
||||
|
||||
return is_invalid_impl(device, expressions);
|
||||
}
|
||||
|
||||
|
@@ -109,6 +109,8 @@ void profiles::value_type::execute(controller<expressions_tuple> const & expr)
|
||||
}
|
||||
|
||||
//Prediction
|
||||
static const int MAX_TEMPORARY_WORKSPACE = 1e6;
|
||||
|
||||
int label = 0;
|
||||
if(expr.dispatcher_options().label>=0)
|
||||
label = expr.dispatcher_options().label;
|
||||
@@ -120,13 +122,13 @@ void profiles::value_type::execute(controller<expressions_tuple> const & expr)
|
||||
do{
|
||||
label = std::distance(predictions.begin(),std::max_element(predictions.begin(), predictions.end()));
|
||||
predictions[label] = 0;
|
||||
}while(templates_[label]->is_invalid(expr.x(),queue_.device()));
|
||||
}while(templates_[label]->temporary_workspace(expr.x()) > MAX_TEMPORARY_WORKSPACE);
|
||||
}
|
||||
|
||||
//Execution
|
||||
int err = templates_[label]->is_invalid(expr.x(), queue_.device());
|
||||
if(err != 0)
|
||||
throw operation_not_supported_exception("The supplied parameters for this template are invalid : err " + tools::to_string(err));
|
||||
if(templates_[label]->temporary_workspace(expr.x()) > MAX_TEMPORARY_WORKSPACE)
|
||||
throw operation_not_supported_exception("Running this operation would require an overly large temporary.");
|
||||
|
||||
return templates_[label]->enqueue(queue_, program, tools::to_string(label), *fallback_, expr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user