Make the device binary copy optional
Device binaries that are embedded inside the host binary do not require a copy. Their lifetime is guaranteed to exceed that of the loaded executable. Add a 'make_copy' parameter to amd::Program::addDeviceProgram. If make_copy is false the original image will be used and will not get freed when the amd::Program is destroyed. Change-Id: I7973bb0243f5a2d1b639b8a88445cfe6af919dd7
Este commit está contenido en:
cometido por
Laurent Morichetti
padre
b54c3f7db9
commit
9e1964ddaa
@@ -37,6 +37,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
namespace amd {
|
||||
@@ -79,7 +80,7 @@ class Context;
|
||||
//! A collection of binaries for devices in the associated context.
|
||||
class Program : public RuntimeObject {
|
||||
public:
|
||||
typedef std::pair<uint8_t*, size_t> binary_t;
|
||||
typedef std::tuple<const uint8_t* /*image*/, size_t /*size*/, bool /*allocated*/> binary_t;
|
||||
typedef std::set<Device const*> devicelist_t;
|
||||
typedef std::unordered_map<Device const*, binary_t> devicebinary_t;
|
||||
typedef std::unordered_map<Device const*, device::Program*> deviceprograms_t;
|
||||
@@ -167,7 +168,7 @@ class Program : public RuntimeObject {
|
||||
|
||||
//! Add a new device program with or without binary image and options.
|
||||
int32_t addDeviceProgram(Device&, const void* image = NULL, size_t len = 0,
|
||||
amd::option::Options* options = NULL);
|
||||
bool make_copy = true, amd::option::Options* options = NULL);
|
||||
|
||||
//! Find the section for the given device. Return NULL if not found.
|
||||
device::Program* getDeviceProgram(const Device& device) const;
|
||||
|
||||
Referencia en una nueva incidencia
Block a user