import { a as S, N as h, e as b } from "../../index-DSGwv2Yx.js";
import { reshape16 as d } from "../reshape16.js";
import x from "./softmax16_program.js";
import k from "./softmax16_subgroup_program.js";
import l from "./utils/deviceInfo.js";
import { r as z } from "../../reshape-BIN71H3p.js";
function F(a) {
  const { inputs: t, backend: o, attrs: p } = a, { logits: e } = t, { dim: r } = p, m = o.subgroupMinSize, i = o.subgroupMaxSize, c = l(o).subgroupsSupported, s = z(e, [
    h(e.shape) / e.shape[r],
    e.shape[r]
  ]), u = c ? new k(s.shape, m, i) : new x(s.shape), f = o.runWebGPUProgram(u, [s], "packedF16");
  s.dispose();
  const n = b().makeTensorFromTensorInfo(f), g = d(n, e.shape);
  return n.dispose(), g;
}
const I = {
  kernelName: "Softmax16",
  backendName: "webgpu",
  kernelFunc: F
};
S(I);
