Skip to content

Commit

Permalink
Update Split.metal
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiaohehe001 authored Nov 1, 2021
1 parent 2cd70b6 commit 63704f6
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions lite/backends/metal/metal_kernel/texture/Split.metal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 ftypeaddleftypeaddle Authors. All Rights Reserved.
/* Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -132,11 +132,7 @@ kernel void split_zz(texture2d_array<ftype, access::read> input[[texture(0)]],
if (z - (sp.vdim[1] + 3) / 4 < 0) {
int z_origin = z * 4 + sp.vdim[0];
int z_end = min(z_origin + 3, sp.vdim[0] + sp.vdim[1] - 1);
ftype4 r;
r[0] = 0;
r[1] = 0;
r[2] = 0;
r[3] = 0;
ftype4 r = 0;
ftype4 r1 = input.read(gid.xy, z_origin / 4);
int start = z_origin % 4;
for (int i = start; i < 4 && i - start <= z_end - z_origin; i++) {
Expand All @@ -155,11 +151,7 @@ kernel void split_zz(texture2d_array<ftype, access::read> input[[texture(0)]],
if (z - (sp.vdim[2] + 3) / 4 < 0) {
int z_origin = z * 4 + sp.vdim[0] + sp.vdim[1];
int z_end = min(z_origin + 3, sp.vdim[0] + sp.vdim[1] + sp.vdim[2] - 1);
ftype4 r;
r[0] = 0;
r[1] = 0;
r[2] = 0;
r[3] = 0;
ftype4 r = 0;
ftype4 r1 = input.read(gid.xy, z_origin / 4);
int start = z_origin % 4;
for (int i = start; i < 4 && i - start <= z_end - z_origin; i++) {
Expand All @@ -180,11 +172,7 @@ kernel void split_zz(texture2d_array<ftype, access::read> input[[texture(0)]],
int z_origin = z * 4 + sp.vdim[0] + sp.vdim[1] + sp.vdim[2];
int z_end =
min(z_origin + 3, sp.vdim[0] + sp.vdim[1] + sp.vdim[2] + sp.vdim[3] - 1);
ftype4 r;
r[0] = 0;
r[1] = 0;
r[2] = 0;
r[3] = 0;
ftype4 r = 0;
ftype4 r1 = input.read(gid.xy, z_origin / 4);
int start = z_origin % 4;
for (int i = start; i < 4 && i - start <= z_end - z_origin; i++) {
Expand Down

0 comments on commit 63704f6

Please sign in to comment.