| 105 | } |
| 106 | |
| 107 | std::string GetGlobalAddress(TensorStorageType storage_type, |
| 108 | const std::string& size_name, |
| 109 | const std::string& var_name, const std::string& x, |
| 110 | const std::string& y, const std::string& z) { |
| 111 | const std::string address = |
| 112 | GetGlobalAddressNoDeclaration(storage_type, size_name, x, y, z); |
| 113 | switch (storage_type) { |
| 114 | case TensorStorageType::BUFFER: |
| 115 | return absl::StrCat("int ", var_name, " = ", address, ";\n"); |
| 116 | case TensorStorageType::TEXTURE_2D: |
| 117 | return absl::StrCat("int2 ", var_name, " = ", address, ";\n"); |
| 118 | case TensorStorageType::SINGLE_TEXTURE_2D: |
| 119 | return absl::StrCat("int2 ", var_name, " = ", address, ";\n"); |
| 120 | case TensorStorageType::TEXTURE_ARRAY: |
| 121 | return absl::StrCat("int4 ", var_name, " = ", address, ";\n"); |
| 122 | case TensorStorageType::UNKNOWN: |
| 123 | return ""; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | std::string GetReadImageFromDataType(DataType data_type) { |
| 128 | if (data_type == DataType::FLOAT32) { |
no test coverage detected