Get the TFLite Vulkan backend to work on iOS and macOS with MoltenVK.
PiperOrigin-RevId: 303994534 Change-Id: Id4f41a428368ac31d05ffb004da69d0deaaf6cec
This commit is contained in:
parent
8f195b3c5b
commit
b38cb7c7a1
@ -22,7 +22,17 @@ limitations under the License.
|
||||
namespace tflite {
|
||||
namespace gpu {
|
||||
|
||||
enum class GpuType { UNKNOWN, MALI, ADRENO, POWERVR, INTEL, NVIDIA };
|
||||
// The VendorID returned by the GPU driver.
|
||||
enum class GpuType {
|
||||
UNKNOWN,
|
||||
APPLE,
|
||||
MALI,
|
||||
ADRENO,
|
||||
POWERVR,
|
||||
INTEL,
|
||||
AMD,
|
||||
NVIDIA,
|
||||
};
|
||||
enum class GpuModel {
|
||||
UNKNOWN,
|
||||
// Adreno 6xx series
|
||||
|
@ -92,8 +92,15 @@ class FullyConnectedBuffers : public NodeShader {
|
||||
source += " $output_data_0[0, 0, gid.x] = value_0$;";
|
||||
|
||||
std::vector<Variable> shared_variables = {
|
||||
#ifdef __APPLE__
|
||||
// MoltenVK has problems with shared memory sized using the workgroup
|
||||
// size. Fortunately with Metal a fixed workgroup size of 32 seems to
|
||||
// give optimal results.
|
||||
{"sh_mem", std::vector<float4>(32)},
|
||||
#else
|
||||
// The actual size of sh_mem depends on the WorkgroupSize
|
||||
{"sh_mem", std::vector<float4>(0)},
|
||||
#endif
|
||||
};
|
||||
|
||||
*generated_code = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user