Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +29 -0
- .inductor_cache/25/c25l73lomz5i5p2tjttjp4w3njz7barnpiaq2fsgnq3jaafgxdsu.py +29 -0
- .inductor_cache/25/ee4f2760622c1bc46e4963f5f90e772637bf02dfce9d2c784a23b91a485e6046.best_config +1 -0
- .inductor_cache/2b/c2br4a6gmsccqokjlyz2ntpodyioqvw3ssadyruqv4t5q2h4zfkq.py +291 -0
- .inductor_cache/2k/0db56ce0255d17e714d6bfefd0830f67b79f31c3cd47fef86e1215e4af155123.best_config +1 -0
- .inductor_cache/2k/c2kidoyobarbdwts46exm2wpdobdyvsxybtugfjxnxbjmacldvms.py +29 -0
- .inductor_cache/2u/c2ushp4u2x3uzdiuj2hcvldtsjtcukrffzblul73u3eczxkoqeiw.py +293 -0
- .inductor_cache/3e/c3exb3qmzq5ev7yyxp6jzpk55mrxicwt5fjnjg72h4blbjqteq3b.py +25 -0
- .inductor_cache/3h/c3hjatdysmtczt36qylu5u476tmnxdvxgytr7m6z4na54xrxxoss.py +24 -0
- .inductor_cache/3h/c3hzz247khkgmf7sy4wb5vbaz4z24jsfnh2gf3spavzjd7bow5gg.py +27 -0
- .inductor_cache/3r/c3rryctepqjzosdqqttq5mb7kr5klk4hfq7vyabrmirmlhcabwmo.py +137 -0
- .inductor_cache/3s/c3skh52gob24udbqevuvymapfeanznl6g6yugtw6fyk24ox5ioyb.py +142 -0
- .inductor_cache/3u/c3u6bcbbftmiqp5kte3h55vd5gqx7jl3zql7a2czxn52qwb3z3xt.py +289 -0
- .inductor_cache/3z/c3ztg2btpqdyc3uz4dzswnkglhrmeaszpogpdu23omfz4c6u7zko.py +27 -0
- .inductor_cache/46/9ddaabf0d63fddb6e484df5802c5ab86ddbc3d9b84c46c643b006cc0acf7b995.best_config +1 -0
- .inductor_cache/46/c46gch5kg22oprcsfx3k73s77cdoj5zwmm4trujfwwc4zc7cs72z.py +24 -0
- .inductor_cache/47/c47i4hdzezcx3xndn3biber6sa6rznklzeek5cbpexpomknwaqjt.py +177 -0
- .inductor_cache/4b/c4bzcwru43j45mp2ej3abi6jtvpi4pqeiwedj4gy3vcydr2jkwun.py +289 -0
- .inductor_cache/4b/c4bzoixvavbv7tbgxpx5sajtax6yl6d6wky5k272ff4wk64t7jd7.py +25 -0
- .inductor_cache/4i/c4iwhfgin6ac7qvqb6fj5msgdftp5qsxjv6sjxyuqbryq4qqwzfg.py +37 -0
- .inductor_cache/4l/c4ljp5q37q7ktbyo35672uzle4llt4iwt4be37ikkwlit6j7fnco.py +31 -0
- .inductor_cache/4l/dccab99d67a1299427a9211bfd01fd3c77aaa44ad59d9ffa12a6d00f48a13c0e.best_config +1 -0
- .inductor_cache/4n/c4nxaenxhyi2kg2uordabgcp5ofkprcosqtxys5klrlaly24kcgm.py +293 -0
- .inductor_cache/4w/88c2a3ee4b3f9188d0485d1f58c19da2936d66802465a9e388f74d179d8ec54e.best_config +1 -0
- .inductor_cache/4w/c4wbe3nz76vrohi4tguyhvtuuwxq5ot6a6vjcubrww3al5ynrkzg.py +26 -0
- .inductor_cache/5d/c5dllvj5zhsrbv5yhs4lnnrfdo5t7vsfkgewb73jsq5ipppt5rbn.py +37 -0
- .inductor_cache/5f/c5fm757ws5k72edgygk6waomo4dh4sqhl7n4rzqsynjfqrzjugov.py +150 -0
- .inductor_cache/5l/c5lhmqi55bmiwxrtdbnsnvjgutkpxgsd6sl2mrliaofj5ojwc2gs.py +24 -0
- .inductor_cache/5p/c5pplmatftc6r3hsuhx4skgsikwfs4k4t74mko7xfk7xp2sqleis.py +46 -0
- .inductor_cache/5q/c5qdusbmow5b3zrnnn4oh343d7oyptsndbeaenzknk5r4mhn7org.py +148 -0
- .inductor_cache/5s/c5s4bm2q3gua3tgmxnj3denzqvuhpgrb5kx5rjwxxb4isc7lmqaz.py +24 -0
- .inductor_cache/5v/1eb21a9ba8eeb898c12aad6f0c7f6fb253af198de2a96f9596a41157018121fd.best_config +1 -0
- .inductor_cache/5v/c5vsrxfkmbxmqe35ujjlxyr37blswcxqhqzlv2r6jal54yzc27hf.py +31 -0
- .inductor_cache/5z/c5ztwyl3hjethlv2ot2kpnvlbaqjstzofdcjttbjwa7nkglx5gan.py +45 -0
- .inductor_cache/62/c62vhrldvf7yqvelctjx64ts5ifznauctxiqhwo4jrqxe2rtpdgj.py +37 -0
- .inductor_cache/65/c156cdb4f80a03134d5d44666437b38d33a91660ba036c9600b2b2dad614b347.best_config +1 -0
- .inductor_cache/65/c657qxcjufcctv3zrgtm2r3tsalyqcuqrzgzqct6qvtmivqg7fnt.py +237 -0
- .inductor_cache/65/c65lswedy4nxnsl65ku4a6ddu3r55grrzzjaxx6jvoroewo6e2dr.py +24 -0
- .inductor_cache/67/c67bawm35pfjbqa2hnubkrofni4tkbxzyeo5zppu6gsylvqve6eo.py +46 -0
- .inductor_cache/6d/c6dqripf2w5j4sf6yps4zy7tc4ifqtp2wzcncsdxelw7lhj3o7ou.py +31 -0
- .inductor_cache/6d/e62944c5f38dab9ccf24b5504699965ed3bab66acfacc866085a1032c963177d.best_config +1 -0
- .inductor_cache/6e/c6emtbesfuldnxatnjaketbq4pjgfhpuh5rpsfrb6iagv4wjnfal.py +45 -0
- .inductor_cache/6j/c6j7f2zfedgsifsvrtdzvprpzw6jujih2uwmzsjrvvfsrmkhcotk.py +24 -0
- .inductor_cache/6p/28650630bd03810b78b7cf75754dfa35da9d5ed77d198e2f0ce9f078547bb750.best_config +1 -0
- .inductor_cache/6p/c6ppnyt6kjnrqeeq3ra4wx4kwkpeerqiq5ftck3hdmvntgpd6wcs.py +31 -0
- .inductor_cache/6r/c6rthxci3676wj2mwj62e5zmpmln5m2yrpnp2cb63gsxh4u2zxhz.py +27 -0
- .inductor_cache/6u/c6uum37r4isrc4g6cyxmskeeex5jl3phh26m7xujcnuux4ijq3jw.py +24 -0
- .inductor_cache/6y/c6ygrpcdbuohowjvpdfmrangdf56jqj3p4ig3uwlgavr6t5kkb7a.py +289 -0
- .inductor_cache/6z/c6zyuqh3bo3nxnmo267egfmzuh75yqhd4pdyfrvq5jc5nfexlxsk.py +29 -0
- .inductor_cache/76/c76y7ge3o24p7dwc6aulba5id74axw62oevitux7yjjlbrbsx66u.py +24 -0
.gitattributes
CHANGED
|
@@ -40,3 +40,32 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 40 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.90eae1ab237a693a257487aad7842565/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
| 41 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.af12de49d08ff397b1c7554f220e6597/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
| 42 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.c6fd39548efd6fe8a937748812a3e10a/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.90eae1ab237a693a257487aad7842565/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
| 41 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.af12de49d08ff397b1c7554f220e6597/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
| 42 |
.deepgemm_cache/cache/kernel.sm100_fp8_fp4_gemm_1d1d.c6fd39548efd6fe8a937748812a3e10a/kernel.cubin filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
.inductor_cache/fxgraph/27/f27o6rx7rg342hrpfcctpozlvg2354yl763qkw33npuhcekxnxvx/pflgmkza6wuxeoggbjr4xfhju3ibc55p5gnpis43uorvrxtlrmh filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
.inductor_cache/fxgraph/2e/f2e72cs2himbdjdco76jkk3trv55ibzgjmoifvwu7tb34ktssjhh/6gullbj7edgkiktugt2he7mesfwclsy5raw6dglloko3uspiqy2 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
.inductor_cache/fxgraph/2p/f2pf3j65kzed74uq5lvpxpfplizuyv6x52wv7qv64wwtincssr3s/t34zgqbous3g4lrapvk3wbanvlmlwpbtm2hi2dmngublqtvxisf filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
.inductor_cache/fxgraph/2u/f2uhif635vilodxlv35gpth7llbzckhikr3iwsrbg55jpg774kzz/ihyw5jfjjhba4ez3o7v6smsujpqvqkgeqlrf4lfn46hf7ja7goz filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
.inductor_cache/fxgraph/4c/f4crukekl2q4oj6klh4aefch64yefn72dasfszf24dnjhppejj3l/dw4ib5mfqhplqjzabsma6owfjrcpkyospwgpcet77ljmildo6dg filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
.inductor_cache/fxgraph/4j/f4jybcn634vohda6titi7rjezc327bgwoltofglm762dzwamzdrk/l4pbixckj6ctoue2a75adlb7u5glqh7bdxwvprzgnzimlpkw6dg filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
.inductor_cache/fxgraph/4j/f4jz56k7lt5fzkjimb76e2yeurm2tos3ipwhwughnwcua37of4yz/t6bcknkpglo54urosygfl4fkfwoyt4zwq47inpzgybrkszraiii filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
.inductor_cache/fxgraph/4v/f4v3fpddde5fxc5onden54afaldv44pfinjr3zwpoqshn4dcjdq7/5ekiicitorrjyxvyojy6sabvh7hdecyuayupme4guanzafuebbe filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
.inductor_cache/fxgraph/4v/f4voaijtwe4rxxqyzibi75obtxemydk6jkevx54gwvuanxfiao2l/nhhp6x3jondquscd7cuzoq52aovdeujbkzmwzudwcxdcw2bgnce filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
.inductor_cache/fxgraph/5k/f5k5zeqlmtxtd4jwnntyatfxjshxbmsjzmu3ev43krpb2tgi56g5/lu6n3wpw55jalcyxkmnrei6gm7svqf6z6rs2wzbgry2d3tcvvf2 filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
.inductor_cache/fxgraph/5q/f5qookrxhpxcnygkcsudllc6lzphv7z2bong6ortsxfsitfszgwx/5bn4r3hiosjxui5ozhesnrhxcxfggbs53wqwrwvwvi4iytnnfkf filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
.inductor_cache/fxgraph/5u/f5udb3yqw6ucuuxytagy7rrjgdadcka26nxm62ljjtnnpde2vnl3/teu2agn5grj5aehuwrr5y4a6g7ha3zuysju7trztwmlpkxzwjye filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
.inductor_cache/fxgraph/6p/f6psuxovydhqk4xi3b22ojx42wojnf33fwf5drilv6vzbncv7fri/54jtv5thlxj7f4r5473jbalyqcp7h6p7tcyyxxv4rv3k7zpqkjv filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
.inductor_cache/fxgraph/6u/f6u25xqfyhztf263nqz5vado2ex7gvnlxfuqm66cfnt4z6ieimlp/dywxqfdb2gqp55mpbuvh5pr6qahukheadkm2llelsdohyznoogf filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
.inductor_cache/fxgraph/7o/f7opkp5cvt3j6ikw2fyouf64oba4fezzcj4r6zk7n4yv6p3m72eu/emfqppmxr4n7c5tbctsig2ga7hn6nclrazq4a3ka5u56bwx734m filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
.inductor_cache/fxgraph/7t/f7tn2io7ayr7x5tu2gjd3vmrvbyenydz6oc52mxp4hofypxpeee6/qn6klb62v3wxkb4ouqb4najn2hjll3anozmroescfej6utvv4hz filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
.inductor_cache/fxgraph/a5/fa5wwiv5umznfk2rud2x76gcfkmgriafshohdcyfg7xpldpsluld/v7f4ds3qd7op7qywdbxdzjnnuavkrj5xkrt2vcdpkghya6457ou filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
.inductor_cache/fxgraph/ag/fagpnbyz6qsj4o4rhzhe2ac2k7hdme2u6dnzzdnwj4w5uolubxql/7nfpyb4zwi4r6z5v2h6muyg7w3fjecn4fagrz3vdgnxwjgj7375 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
.inductor_cache/fxgraph/b4/fb4zezob3jxdhc73kfbgtguwug3mmje7nxolr36iz7kx46apw7df/lgvuv2uwxfvnlq3ohnze2firqcj33fihxg7dj6q76qvrx6hkkeu filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
.inductor_cache/fxgraph/bc/fbc56yg6xd66zhguh2xlywojvovffbq2n7j4hmtuxzzwlbzzbzvk/n2hm7wnehwvy7dcevenu3tyodtyptvj4ky7pheh4nzks3v63ywg filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
.inductor_cache/fxgraph/bt/fbtavbf4pvujmngczgl6753sfx5lk4upod7lztkf6xn5mfo5ui2i/c3vic4qhyhwi6meuzp6tzqxgmtff45qcyke7ncdavm43jdyfrpi filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
.inductor_cache/fxgraph/cs/fcsbsthsjevo3pq4hhgfznr43x43vci6svn52fswfmthwp7ceays/f7b6sqkvl6h7rbkrddgbhh2h4amnkd3pjfzcncyozean6m6fnvp filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
.inductor_cache/fxgraph/d2/fd2odm7ueokhvpawrjqys35tbv2nw6o5yo7bznkfoynzjw77u6o3/ev6rhyy2or2qh5hkq5nfptoibvr454zmvb4fnqxaz742cpovcxw filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
.inductor_cache/fxgraph/d5/fd5i3x6ajyufaljzozolyk2vvlw5ifeocxk567pxqsldwnkgbzac/cvftq2lyjskfpmqggmfh7rw7wjkiwcodueaxdz7xptb2e5qr4oq filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
.inductor_cache/fxgraph/db/fdbh2b7mmtbe7t2e3d5aelbwyuq46auimsmou63qd33zl72bvhhz/f4tskhvu6digwxpchylk7r7y74dcom4aww3je6gegxyxlajenek filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
.inductor_cache/fxgraph/di/fdiqmibwfdhcuuhs6ayweylnfwssarjftn3lqpexzhq2logikdnw/relotiy2jcf55dx27zynszkp5mmgz7enr6yhp24yr7rby3wknnb filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
.inductor_cache/fxgraph/dm/fdm2vzq6owyuyrvgtsaes3bqjsea7j5opkbrjzp5yvk5eaaie5pl/juvux776sz7j5tpilt2sb75ihyp7tky5qivngzbufmm3tjuqpba filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
.inductor_cache/fxgraph/do/fdoxsfn5zevmxnouexpdozewmmuesmji2gxbdbzj55iu2kzfirwm/hvjmffewl5g3xzs2qjxlyiinbyyddnb4vdrxjeuae74vp4m2wn6 filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
.inductor_cache/fxgraph/e4/fe45sfef754ayge22g3uuqjzhgodjdocya5lpr2tx6l7i4vkqwit/6ry3bcpdcxz45iibyaetr3ddq2vx2x6ubevfyovvrvlttmmlivr filter=lfs diff=lfs merge=lfs -text
|
.inductor_cache/25/c25l73lomz5i5p2tjttjp4w3njz7barnpiaq2fsgnq3jaafgxdsu.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 256},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 4096}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 25 |
+
tmp3 = in_ptr2
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tmp4 = tmp3.to(tl.float32)
|
| 28 |
+
tmp5 = tmp2 * tmp4
|
| 29 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
.inductor_cache/25/ee4f2760622c1bc46e4963f5f90e772637bf02dfce9d2c784a23b91a485e6046.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 128, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 21, "triton_cache_hash": "YG74CS4JHDXVAWUXP7QZ23NAXRAHIYIZ5FUJMRPVXQLZO4XINHZA"}
|
.inductor_cache/2b/c2br4a6gmsccqokjlyz2ntpodyioqvw3ssadyruqv4t5q2h4zfkq.py
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['7_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/xb/cxbfao4txftywezeygrrwtapgjmjuaow6yckdgujtj3ln7ukpbdn.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s0, 1][1, 1]cuda:0" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg4_1 : Tensor "f32[s0, 1][1, 1]cuda:0" = PlaceHolder[target=arg4_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:0" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg4_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:0"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 8},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/jk/cjk2l5do5kfebmlafwv2ddtivblyn54wzypw3yv4cn4tgq7w7p46.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg5_1 : Tensor "i64[s0, 1][1, 1]cuda:0" = PlaceHolder[target=arg5_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg5_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 8},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/xb/cxbqyqxwwyvdsshstrz3zl343674btixfm5kbidvymejf6qmdoaf.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg7_1 : Tensor "bf16[s0, s87][s87, 1]cuda:0" = PlaceHolder[target=arg7_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s0][1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg3_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s0][1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s0][1]cuda:0"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg3_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:0, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s0][1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg3_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s0][1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s0, s87][s87, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg7_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 65536},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 294912}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/f5/cf5tdjh7czx76ocdvaqqmpbpt24xihjxufk72ezsjzb26rz66qx3.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s0, 1][1, 1]cuda:0"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg8_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 8},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 128}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s68 = arg1_1
|
| 231 |
+
s0 = arg3_1
|
| 232 |
+
s87 = arg6_1
|
| 233 |
+
s77 = arg8_1
|
| 234 |
+
assert_size_stride(arg2_1, (s0, 1), (1, 1))
|
| 235 |
+
assert_size_stride(arg4_1, (s0, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg5_1, (s0, 1), (1, 1))
|
| 237 |
+
assert_size_stride(arg7_1, (s0, s87), (s87, 1))
|
| 238 |
+
with torch.cuda._DeviceGuard(0):
|
| 239 |
+
torch.cuda.set_device(0)
|
| 240 |
+
buf0 = empty_strided_cuda((s0, 1, 1), (1, 1, 1), torch.float32)
|
| 241 |
+
buf1 = empty_strided_cuda((s0, 1), (1, 1), torch.float32)
|
| 242 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 243 |
+
stream0 = get_raw_stream(0)
|
| 244 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg4_1, buf0, buf1, s0, stream=stream0)
|
| 245 |
+
del arg2_1
|
| 246 |
+
del arg4_1
|
| 247 |
+
buf2 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 248 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 249 |
+
stream0 = get_raw_stream(0)
|
| 250 |
+
triton_poi_fused_gather_max_view_1.run(arg5_1, buf2, s0, stream=stream0)
|
| 251 |
+
buf3 = empty_strided_cuda((s0, s87), (s87, 1), torch.bfloat16)
|
| 252 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 253 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s0*s87
|
| 254 |
+
stream0 = get_raw_stream(0)
|
| 255 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg7_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream0)
|
| 256 |
+
del arg7_1
|
| 257 |
+
buf4 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 258 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 259 |
+
stream0 = get_raw_stream(0)
|
| 260 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s0, stream=stream0)
|
| 261 |
+
return (reinterpret_tensor(buf2, (s0, ), (1, ), 0), buf3, buf1, buf0, arg5_1, buf4, )
|
| 262 |
+
|
| 263 |
+
runner = Runner(partitions=[])
|
| 264 |
+
call = runner.call
|
| 265 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def get_args():
|
| 269 |
+
from torch._dynamo.testing import rand_strided
|
| 270 |
+
arg0_1 = 1
|
| 271 |
+
arg1_1 = 8
|
| 272 |
+
arg2_1 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
|
| 273 |
+
arg3_1 = 8
|
| 274 |
+
arg4_1 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.float32)
|
| 275 |
+
arg5_1 = rand_strided((8, 1), (1, 1), device='cuda:0', dtype=torch.int64)
|
| 276 |
+
arg6_1 = 6144
|
| 277 |
+
arg7_1 = rand_strided((8, 6144), (6144, 1), device='cuda:0', dtype=torch.bfloat16)
|
| 278 |
+
arg8_1 = 2
|
| 279 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1]
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 283 |
+
from torch._inductor.utils import print_performance
|
| 284 |
+
fn = lambda: call(list(args))
|
| 285 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
if __name__ == "__main__":
|
| 289 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 290 |
+
args = get_args()
|
| 291 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/2k/0db56ce0255d17e714d6bfefd0830f67b79f31c3cd47fef86e1215e4af155123.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 21, "triton_cache_hash": "5FUAZKDVQOXOEQJ4ZSRVOWBR6F6PBWI7HIJDQ3SM267VH2IXPT5A"}
|
.inductor_cache/2k/c2kidoyobarbdwts46exm2wpdobdyvsxybtugfjxnxbjmacldvms.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 256},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 4096}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 25 |
+
tmp3 = in_ptr2
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tmp4 = tmp3.to(tl.float32)
|
| 28 |
+
tmp5 = tmp2 * tmp4
|
| 29 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
.inductor_cache/2u/c2ushp4u2x3uzdiuj2hcvldtsjtcukrffzblul73u3eczxkoqeiw.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['13_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/in/cinym3hv7fv6jpjbbmmapeljldm7umzd5htvihr3dlt7qh5h5e5p.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s0, 1][1, 1]cuda:2" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg4_1 : Tensor "f32[s0, 1][1, 1]cuda:2" = PlaceHolder[target=arg4_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:2" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg4_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:2"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 2},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/ew/cewhk2e3t5msoqsn3m7nynvzesfjqgc746bztsvg7puyhydc7sr4.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg6_1 : Tensor "i64[s37, 1][1, 1]cuda:2" = PlaceHolder[target=arg6_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg6_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 2},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/65/c65lswedy4nxnsl65ku4a6ddu3r55grrzzjaxx6jvoroewo6e2dr.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg8_1 : Tensor "bf16[s0, s87][s87, 1]cuda:2" = PlaceHolder[target=arg8_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s0][1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg3_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s0][1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s0][1]cuda:2"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg3_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:2, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s0][1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg3_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s0][1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s0, s87][s87, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg8_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 16384},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 73728}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/y5/cy5huhsgetyuqpiq72l6lba4jexcwsdpngrz2iwahbpopxclyk44.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s0, 1][1, 1]cuda:2"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg9_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 2},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 8}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s68 = arg1_1
|
| 231 |
+
s0 = arg3_1
|
| 232 |
+
s37 = arg5_1
|
| 233 |
+
s87 = arg7_1
|
| 234 |
+
s77 = arg9_1
|
| 235 |
+
assert_size_stride(arg2_1, (s0, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg4_1, (s0, 1), (1, 1))
|
| 237 |
+
assert_size_stride(arg6_1, (s37, 1), (1, 1))
|
| 238 |
+
assert_size_stride(arg8_1, (s0, s87), (s87, 1))
|
| 239 |
+
with torch.cuda._DeviceGuard(2):
|
| 240 |
+
torch.cuda.set_device(2)
|
| 241 |
+
buf0 = empty_strided_cuda((s0, 1, 1), (1, 1, 1), torch.float32)
|
| 242 |
+
buf1 = empty_strided_cuda((s0, 1), (1, 1), torch.float32)
|
| 243 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 244 |
+
stream2 = get_raw_stream(2)
|
| 245 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg4_1, buf0, buf1, s0, stream=stream2)
|
| 246 |
+
del arg2_1
|
| 247 |
+
del arg4_1
|
| 248 |
+
buf2 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 249 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 250 |
+
stream2 = get_raw_stream(2)
|
| 251 |
+
triton_poi_fused_gather_max_view_1.run(arg6_1, buf2, s0, stream=stream2)
|
| 252 |
+
buf3 = empty_strided_cuda((s0, s87), (s87, 1), torch.bfloat16)
|
| 253 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 254 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s0*s87
|
| 255 |
+
stream2 = get_raw_stream(2)
|
| 256 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg8_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream2)
|
| 257 |
+
del arg8_1
|
| 258 |
+
buf4 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 259 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 260 |
+
stream2 = get_raw_stream(2)
|
| 261 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s0, stream=stream2)
|
| 262 |
+
return (reinterpret_tensor(buf2, (s0, ), (1, ), 0), buf3, buf1, buf0, arg6_1, buf4, )
|
| 263 |
+
|
| 264 |
+
runner = Runner(partitions=[])
|
| 265 |
+
call = runner.call
|
| 266 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def get_args():
|
| 270 |
+
from torch._dynamo.testing import rand_strided
|
| 271 |
+
arg0_1 = 1
|
| 272 |
+
arg1_1 = 2
|
| 273 |
+
arg2_1 = rand_strided((2, 1), (1, 1), device='cuda:2', dtype=torch.float32)
|
| 274 |
+
arg3_1 = 2
|
| 275 |
+
arg4_1 = rand_strided((2, 1), (1, 1), device='cuda:2', dtype=torch.float32)
|
| 276 |
+
arg5_1 = 2
|
| 277 |
+
arg6_1 = rand_strided((2, 1), (1, 1), device='cuda:2', dtype=torch.int64)
|
| 278 |
+
arg7_1 = 6144
|
| 279 |
+
arg8_1 = rand_strided((2, 6144), (6144, 1), device='cuda:2', dtype=torch.bfloat16)
|
| 280 |
+
arg9_1 = 1
|
| 281 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1]
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 285 |
+
from torch._inductor.utils import print_performance
|
| 286 |
+
fn = lambda: call(list(args))
|
| 287 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
if __name__ == "__main__":
|
| 291 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 292 |
+
args = get_args()
|
| 293 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/3e/c3exb3qmzq5ev7yyxp6jzpk55mrxicwt5fjnjg72h4blbjqteq3b.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp1, None)
|
.inductor_cache/3h/c3hjatdysmtczt36qylu5u476tmnxdvxgytr7m6z4na54xrxxoss.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 8},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
.inductor_cache/3h/c3hzz247khkgmf7sy4wb5vbaz4z24jsfnh2gf3spavzjd7bow5gg.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 32},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 384}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_0(in_out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 32
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = xindex < xnumel
|
| 23 |
+
x0 = xindex
|
| 24 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 25 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tl.store(in_out_ptr0 + (x0), tmp2, xmask)
|
.inductor_cache/3r/c3rryctepqjzosdqqttq5mb7kr5klk4hfq7vyabrmirmlhcabwmo.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['10_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/r6/cr6a7je7lgurvwxlurfkudvnwwl26htjtvwwjxnv75jffqdxvgwj.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul => mul_2
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# Graph fragment:
|
| 43 |
+
# %arg1_1 : Tensor "f32[1, s3][s3, 1]cuda:5" = PlaceHolder[target=arg1_1]
|
| 44 |
+
# %arg2_1 : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:5" = PlaceHolder[target=arg2_1]
|
| 45 |
+
# %arg3_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg3_1]
|
| 46 |
+
# %unsqueeze : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg1_1, -1), kwargs = {})
|
| 47 |
+
# %mul_2 : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg2_1), kwargs = {})
|
| 48 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg3_1, torch.float32), kwargs = {})
|
| 49 |
+
# %mul_tensor : Tensor "f32[1, s3, 1][s3, 1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_2, %convert_element_type_default_1), kwargs = {})
|
| 50 |
+
# return %mul_tensor
|
| 51 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 52 |
+
import triton
|
| 53 |
+
import triton.language as tl
|
| 54 |
+
|
| 55 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 56 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 57 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 58 |
+
triton_helpers.set_driver_to_gpu()
|
| 59 |
+
|
| 60 |
+
@triton_heuristics.pointwise(
|
| 61 |
+
size_hints={'x': 32},
|
| 62 |
+
filename=__file__,
|
| 63 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 64 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 512}},
|
| 65 |
+
min_elem_per_thread=0
|
| 66 |
+
)
|
| 67 |
+
@triton.jit
|
| 68 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 69 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 70 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 71 |
+
xmask = xindex < xnumel
|
| 72 |
+
x0 = xindex
|
| 73 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 74 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 75 |
+
tmp3 = in_ptr2
|
| 76 |
+
tmp2 = tmp0 * tmp1
|
| 77 |
+
tmp4 = tmp3.to(tl.float32)
|
| 78 |
+
tmp5 = tmp2 * tmp4
|
| 79 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
| 80 |
+
''', device_str='cuda')
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
async_compile.wait(globals())
|
| 84 |
+
del async_compile
|
| 85 |
+
|
| 86 |
+
class Runner:
|
| 87 |
+
def __init__(self, partitions):
|
| 88 |
+
self.partitions = partitions
|
| 89 |
+
|
| 90 |
+
def recursively_apply_fns(self, fns):
|
| 91 |
+
new_callables = []
|
| 92 |
+
for fn, c in zip(fns, self.partitions):
|
| 93 |
+
new_callables.append(fn(c))
|
| 94 |
+
self.partitions = new_callables
|
| 95 |
+
|
| 96 |
+
def call(self, args):
|
| 97 |
+
arg0_1, arg1_1, arg2_1, arg3_1 = args
|
| 98 |
+
args.clear()
|
| 99 |
+
s3 = arg0_1
|
| 100 |
+
assert_size_stride(arg1_1, (1, s3), (s3, 1))
|
| 101 |
+
assert_size_stride(arg2_1, (1, s3, 1), (s3, 1, 1))
|
| 102 |
+
assert_size_stride(arg3_1, (), ())
|
| 103 |
+
with torch.cuda._DeviceGuard(5):
|
| 104 |
+
torch.cuda.set_device(5)
|
| 105 |
+
buf0 = empty_strided_cuda((1, s3, 1), (s3, 1, 1), torch.float32)
|
| 106 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 107 |
+
stream5 = get_raw_stream(5)
|
| 108 |
+
triton_poi_fused_mul_unsqueeze_0.run(arg1_1, arg2_1, arg3_1.item(), buf0, s3, stream=stream5)
|
| 109 |
+
del arg1_1
|
| 110 |
+
del arg2_1
|
| 111 |
+
del arg3_1
|
| 112 |
+
return (buf0, )
|
| 113 |
+
|
| 114 |
+
runner = Runner(partitions=[])
|
| 115 |
+
call = runner.call
|
| 116 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
def get_args():
|
| 120 |
+
from torch._dynamo.testing import rand_strided
|
| 121 |
+
arg0_1 = 32
|
| 122 |
+
arg1_1 = rand_strided((1, 32), (32, 1), device='cuda:5', dtype=torch.float32)
|
| 123 |
+
arg2_1 = rand_strided((1, 32, 1), (32, 1, 1), device='cuda:5', dtype=torch.float32)
|
| 124 |
+
arg3_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 125 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1]
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 129 |
+
from torch._inductor.utils import print_performance
|
| 130 |
+
fn = lambda: call(list(args))
|
| 131 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
if __name__ == "__main__":
|
| 135 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 136 |
+
args = get_args()
|
| 137 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/3s/c3skh52gob24udbqevuvymapfeanznl6g6yugtw6fyk24ox5ioyb.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['5_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/xd/cxd3xbystwp4gocdmghs5wj2gqmc5bgvjwrd3qc6rcbnrrgpjvtn.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul => mul_2
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# Graph fragment:
|
| 43 |
+
# %arg2_1 : Tensor "f32[s0, s3][s3, 1]cuda:6" = PlaceHolder[target=arg2_1]
|
| 44 |
+
# %arg3_1 : Tensor "f32[s0, s3, 1][s3, 1, 1]cuda:6" = PlaceHolder[target=arg3_1]
|
| 45 |
+
# %arg4_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg4_1]
|
| 46 |
+
# %unsqueeze : Tensor "f32[s0, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, -1), kwargs = {})
|
| 47 |
+
# %mul_2 : Tensor "f32[s0, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg3_1), kwargs = {})
|
| 48 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg4_1, torch.float32), kwargs = {})
|
| 49 |
+
# %mul_tensor : Tensor "f32[s0, s3, 1][s3, 1, 1]cuda:6"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_2, %convert_element_type_default_1), kwargs = {})
|
| 50 |
+
# return %mul_tensor
|
| 51 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 52 |
+
import triton
|
| 53 |
+
import triton.language as tl
|
| 54 |
+
|
| 55 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 56 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 57 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 58 |
+
triton_helpers.set_driver_to_gpu()
|
| 59 |
+
|
| 60 |
+
@triton_heuristics.pointwise(
|
| 61 |
+
size_hints={'x': 256},
|
| 62 |
+
filename=__file__,
|
| 63 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=6, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 64 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 4096}},
|
| 65 |
+
min_elem_per_thread=0
|
| 66 |
+
)
|
| 67 |
+
@triton.jit
|
| 68 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 69 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 70 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 71 |
+
xmask = xindex < xnumel
|
| 72 |
+
x0 = xindex
|
| 73 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 74 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 75 |
+
tmp3 = in_ptr2
|
| 76 |
+
tmp2 = tmp0 * tmp1
|
| 77 |
+
tmp4 = tmp3.to(tl.float32)
|
| 78 |
+
tmp5 = tmp2 * tmp4
|
| 79 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
| 80 |
+
''', device_str='cuda')
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
async_compile.wait(globals())
|
| 84 |
+
del async_compile
|
| 85 |
+
|
| 86 |
+
class Runner:
|
| 87 |
+
def __init__(self, partitions):
|
| 88 |
+
self.partitions = partitions
|
| 89 |
+
|
| 90 |
+
def recursively_apply_fns(self, fns):
|
| 91 |
+
new_callables = []
|
| 92 |
+
for fn, c in zip(fns, self.partitions):
|
| 93 |
+
new_callables.append(fn(c))
|
| 94 |
+
self.partitions = new_callables
|
| 95 |
+
|
| 96 |
+
def call(self, args):
|
| 97 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
|
| 98 |
+
args.clear()
|
| 99 |
+
s7 = arg0_1
|
| 100 |
+
s3 = arg1_1
|
| 101 |
+
arg2_1_size = arg2_1.size()
|
| 102 |
+
s0 = arg2_1_size[0]
|
| 103 |
+
assert_size_stride(arg2_1, (s0, s3), (s3, 1))
|
| 104 |
+
assert_size_stride(arg3_1, (s0, s3, 1), (s3, 1, 1))
|
| 105 |
+
assert_size_stride(arg4_1, (), ())
|
| 106 |
+
with torch.cuda._DeviceGuard(6):
|
| 107 |
+
torch.cuda.set_device(6)
|
| 108 |
+
buf0 = empty_strided_cuda((s0, s3, 1), (s3, 1, 1), torch.float32)
|
| 109 |
+
# Topologically Sorted Source Nodes: [unsqueeze, mul], Original ATen: [aten.unsqueeze, aten.mul]
|
| 110 |
+
triton_poi_fused_mul_unsqueeze_0_xnumel = s0*s3
|
| 111 |
+
stream6 = get_raw_stream(6)
|
| 112 |
+
triton_poi_fused_mul_unsqueeze_0.run(arg2_1, arg3_1, arg4_1.item(), buf0, triton_poi_fused_mul_unsqueeze_0_xnumel, stream=stream6)
|
| 113 |
+
del arg2_1
|
| 114 |
+
del arg3_1
|
| 115 |
+
del arg4_1
|
| 116 |
+
return (buf0, )
|
| 117 |
+
|
| 118 |
+
runner = Runner(partitions=[])
|
| 119 |
+
call = runner.call
|
| 120 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def get_args():
|
| 124 |
+
from torch._dynamo.testing import rand_strided
|
| 125 |
+
arg0_1 = 8
|
| 126 |
+
arg1_1 = 32
|
| 127 |
+
arg2_1 = rand_strided((8, 32), (32, 1), device='cuda:6', dtype=torch.float32)
|
| 128 |
+
arg3_1 = rand_strided((8, 32, 1), (32, 1, 1), device='cuda:6', dtype=torch.float32)
|
| 129 |
+
arg4_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 130 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1]
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 134 |
+
from torch._inductor.utils import print_performance
|
| 135 |
+
fn = lambda: call(list(args))
|
| 136 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
if __name__ == "__main__":
|
| 140 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 141 |
+
args = get_args()
|
| 142 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/3u/c3u6bcbbftmiqp5kte3h55vd5gqx7jl3zql7a2czxn52qwb3z3xt.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['11_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/vx/cvx3kcgx73mdufoqquzcxowf7ugclz7xreckm42p6weslmelfw3l.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_1
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg1_1 : Tensor "f32[1, 1][1, 1]cuda:4" = PlaceHolder[target=arg1_1]
|
| 47 |
+
# %arg2_1 : Tensor "f32[1, 1][1, 1]cuda:4" = PlaceHolder[target=arg2_1]
|
| 48 |
+
# %mul_1 : Tensor "f32[1, 1, 1][1, 1, 1]cuda:4" = PlaceHolder[target=mul_1]
|
| 49 |
+
# %unsqueeze : Tensor "f32[1, 1, 1][1, 1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg1_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[1, 1, 1][1, 1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg2_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_1 : Tensor "f32[1, 1, 1][1, 1, 1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_1, [1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_1,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 1},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xnumel = 1
|
| 75 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 76 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 77 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 79 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 80 |
+
tmp2 = tl.load(in_ptr1 + (0))
|
| 81 |
+
tmp3 = tl.broadcast_to(tmp2, [XBLOCK])
|
| 82 |
+
tmp4 = tmp1 * tmp3
|
| 83 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
| 84 |
+
tl.store(out_ptr1 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp4, None)
|
| 85 |
+
''', device_str='cuda')
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/gp/cgpokyocc7tdinfnb6opabr746t6knz5cgybj5fxyufsucoeojra.py
|
| 89 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 90 |
+
# Source node to ATen node mapping:
|
| 91 |
+
# flatten => view_1
|
| 92 |
+
# gather => gather
|
| 93 |
+
# max_1 => max_1
|
| 94 |
+
# Graph fragment:
|
| 95 |
+
# %arg3_1 : Tensor "i64[1, 1][1, 1]cuda:4" = PlaceHolder[target=arg3_1]
|
| 96 |
+
# %view_1 : Tensor "f32[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_1, [1, 1]), kwargs = {})
|
| 97 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 98 |
+
# %gather : Tensor "i64[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg3_1, 1, %getitem_1), kwargs = {})
|
| 99 |
+
# return %gather
|
| 100 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 101 |
+
import triton
|
| 102 |
+
import triton.language as tl
|
| 103 |
+
|
| 104 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 105 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 106 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 107 |
+
triton_helpers.set_driver_to_gpu()
|
| 108 |
+
|
| 109 |
+
@triton_heuristics.pointwise(
|
| 110 |
+
size_hints={'x': 1},
|
| 111 |
+
filename=__file__,
|
| 112 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 113 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 114 |
+
min_elem_per_thread=0
|
| 115 |
+
)
|
| 116 |
+
@triton.jit
|
| 117 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 118 |
+
xnumel = 1
|
| 119 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 120 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 121 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 122 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 123 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 124 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp1, None)
|
| 125 |
+
''', device_str='cuda')
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/sl/csl35uebvdbczppjgntgmnutdjrljqewnfhmnvz33m6unz7vdiu7.py
|
| 129 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 130 |
+
# Source node to ATen node mapping:
|
| 131 |
+
# batch_offsets => iota
|
| 132 |
+
# flat_cs => view_4
|
| 133 |
+
# flatten => view_1
|
| 134 |
+
# floordiv => div
|
| 135 |
+
# hidden_states => index
|
| 136 |
+
# max_1 => max_1
|
| 137 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 138 |
+
# selected_input_index => add
|
| 139 |
+
# Graph fragment:
|
| 140 |
+
# %arg5_1 : Tensor "bf16[1, s87][s87, 1]cuda:4" = PlaceHolder[target=arg5_1]
|
| 141 |
+
# %view_1 : Tensor "f32[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_1, [1, 1]), kwargs = {})
|
| 142 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 143 |
+
# %view_4 : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [1]), kwargs = {})
|
| 144 |
+
# %div : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 145 |
+
# %iota : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:4, requires_grad: False})
|
| 146 |
+
# %unsqueeze_1 : Tensor "i64[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 147 |
+
# %view_5 : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [1]), kwargs = {})
|
| 148 |
+
# %add : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 149 |
+
# %index : Tensor "bf16[1, s87][s87, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg5_1, [%add]), kwargs = {})
|
| 150 |
+
# return %index
|
| 151 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 152 |
+
import triton
|
| 153 |
+
import triton.language as tl
|
| 154 |
+
|
| 155 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 156 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 157 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 158 |
+
triton_helpers.set_driver_to_gpu()
|
| 159 |
+
|
| 160 |
+
@triton_heuristics.pointwise(
|
| 161 |
+
size_hints={'x': 8192},
|
| 162 |
+
filename=__file__,
|
| 163 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 164 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 36864}},
|
| 165 |
+
min_elem_per_thread=0
|
| 166 |
+
)
|
| 167 |
+
@triton.jit
|
| 168 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 169 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 170 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 171 |
+
xmask = xindex < xnumel
|
| 172 |
+
x0 = xindex
|
| 173 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask).to(tl.float32)
|
| 174 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 175 |
+
''', device_str='cuda')
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/dn/cdnvk7ketvhjg6i2ggdy5oiyemirjdox3326cagxkaqlxhmh5lpp.py
|
| 179 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 180 |
+
# Source node to ATen node mapping:
|
| 181 |
+
# add_2 => add_3
|
| 182 |
+
# flatten => view_1
|
| 183 |
+
# max_1 => max_1
|
| 184 |
+
# Graph fragment:
|
| 185 |
+
# %view_1 : Tensor "f32[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_1, [1, 1]), kwargs = {})
|
| 186 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 187 |
+
# %add_3 : Tensor "i64[1, 1][1, 1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg6_1), kwargs = {})
|
| 188 |
+
# return %add_3
|
| 189 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 190 |
+
import triton
|
| 191 |
+
import triton.language as tl
|
| 192 |
+
|
| 193 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 194 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 195 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 196 |
+
triton_helpers.set_driver_to_gpu()
|
| 197 |
+
|
| 198 |
+
@triton_heuristics.pointwise(
|
| 199 |
+
size_hints={'x': 1},
|
| 200 |
+
filename=__file__,
|
| 201 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 202 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 203 |
+
min_elem_per_thread=0
|
| 204 |
+
)
|
| 205 |
+
@triton.jit
|
| 206 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 207 |
+
xnumel = 1
|
| 208 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 209 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 210 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 211 |
+
tmp0 = ks0
|
| 212 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32)), tmp0, None)
|
| 213 |
+
''', device_str='cuda')
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
async_compile.wait(globals())
|
| 217 |
+
del async_compile
|
| 218 |
+
|
| 219 |
+
class Runner:
|
| 220 |
+
def __init__(self, partitions):
|
| 221 |
+
self.partitions = partitions
|
| 222 |
+
|
| 223 |
+
def recursively_apply_fns(self, fns):
|
| 224 |
+
new_callables = []
|
| 225 |
+
for fn, c in zip(fns, self.partitions):
|
| 226 |
+
new_callables.append(fn(c))
|
| 227 |
+
self.partitions = new_callables
|
| 228 |
+
|
| 229 |
+
def call(self, args):
|
| 230 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1 = args
|
| 231 |
+
args.clear()
|
| 232 |
+
s53 = arg0_1
|
| 233 |
+
s87 = arg4_1
|
| 234 |
+
s77 = arg6_1
|
| 235 |
+
assert_size_stride(arg1_1, (1, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg2_1, (1, 1), (1, 1))
|
| 237 |
+
assert_size_stride(arg3_1, (1, 1), (1, 1))
|
| 238 |
+
assert_size_stride(arg5_1, (1, s87), (s87, 1))
|
| 239 |
+
with torch.cuda._DeviceGuard(4):
|
| 240 |
+
torch.cuda.set_device(4)
|
| 241 |
+
buf0 = empty_strided_cuda((1, 1, 1), (1, 1, 1), torch.float32)
|
| 242 |
+
buf1 = empty_strided_cuda((1, 1), (1, 1), torch.float32)
|
| 243 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 244 |
+
stream4 = get_raw_stream(4)
|
| 245 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg1_1, arg2_1, buf0, buf1, 1, stream=stream4)
|
| 246 |
+
del arg1_1
|
| 247 |
+
del arg2_1
|
| 248 |
+
buf2 = empty_strided_cuda((1, 1), (1, 1), torch.int64)
|
| 249 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 250 |
+
stream4 = get_raw_stream(4)
|
| 251 |
+
triton_poi_fused_gather_max_view_1.run(arg3_1, buf2, 1, stream=stream4)
|
| 252 |
+
buf3 = empty_strided_cuda((1, s87), (s87, 1), torch.bfloat16)
|
| 253 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 254 |
+
stream4 = get_raw_stream(4)
|
| 255 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg5_1, buf3, s87, stream=stream4)
|
| 256 |
+
del arg5_1
|
| 257 |
+
buf4 = empty_strided_cuda((1, 1), (1, 1), torch.int64)
|
| 258 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 259 |
+
stream4 = get_raw_stream(4)
|
| 260 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, 1, stream=stream4)
|
| 261 |
+
return (reinterpret_tensor(buf2, (1, ), (1, ), 0), buf3, buf1, buf0, arg3_1, buf4, )
|
| 262 |
+
|
| 263 |
+
runner = Runner(partitions=[])
|
| 264 |
+
call = runner.call
|
| 265 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def get_args():
|
| 269 |
+
from torch._dynamo.testing import rand_strided
|
| 270 |
+
arg0_1 = 1
|
| 271 |
+
arg1_1 = rand_strided((1, 1), (1, 1), device='cuda:4', dtype=torch.float32)
|
| 272 |
+
arg2_1 = rand_strided((1, 1), (1, 1), device='cuda:4', dtype=torch.float32)
|
| 273 |
+
arg3_1 = rand_strided((1, 1), (1, 1), device='cuda:4', dtype=torch.int64)
|
| 274 |
+
arg4_1 = 6144
|
| 275 |
+
arg5_1 = rand_strided((1, 6144), (6144, 1), device='cuda:4', dtype=torch.bfloat16)
|
| 276 |
+
arg6_1 = 1
|
| 277 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1]
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 281 |
+
from torch._inductor.utils import print_performance
|
| 282 |
+
fn = lambda: call(list(args))
|
| 283 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
if __name__ == "__main__":
|
| 287 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 288 |
+
args = get_args()
|
| 289 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/3z/c3ztg2btpqdyc3uz4dzswnkglhrmeaszpogpdu23omfz4c6u7zko.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 32},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 384}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_0(in_out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 32
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = xindex < xnumel
|
| 23 |
+
x0 = xindex
|
| 24 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 25 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tl.store(in_out_ptr0 + (x0), tmp2, xmask)
|
.inductor_cache/46/9ddaabf0d63fddb6e484df5802c5ab86ddbc3d9b84c46c643b006cc0acf7b995.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 23, "triton_cache_hash": "GIDCKWLVJJFYH72JFJCG4FFIN3BV7CWCQPTZRHJERXHCZJAW4VIA"}
|
.inductor_cache/46/c46gch5kg22oprcsfx3k73s77cdoj5zwmm4trujfwwc4zc7cs72z.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 8192},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 36864}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask).to(tl.float32)
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
.inductor_cache/47/c47i4hdzezcx3xndn3biber6sa6rznklzeek5cbpexpomknwaqjt.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['0_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/jr/cjrkeuk4xjhx774cklsib5ivf4nd32eudc4tub7gpkw5nbrgpf7w.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, mul, mul_1, valid_offset, sub_3, input_, invert], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.mul, aten.add, aten.sub, aten.bitwise_not]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# added_vocab_mask => bitwise_and_1
|
| 41 |
+
# ge => ge
|
| 42 |
+
# ge_1 => ge_1
|
| 43 |
+
# input_ => mul_6
|
| 44 |
+
# invert => bitwise_not
|
| 45 |
+
# lt => lt
|
| 46 |
+
# lt_1 => lt_1
|
| 47 |
+
# mul => mul
|
| 48 |
+
# mul_1 => mul_2
|
| 49 |
+
# org_vocab_mask => bitwise_and
|
| 50 |
+
# sub_3 => sub_13
|
| 51 |
+
# valid_offset => add_16
|
| 52 |
+
# vocab_mask => bitwise_or
|
| 53 |
+
# Graph fragment:
|
| 54 |
+
# %arg1_1 : Tensor "i64[s15][1]cuda:7" = PlaceHolder[target=arg1_1]
|
| 55 |
+
# %ge : Tensor "b8[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg1_1, %arg2_1), kwargs = {})
|
| 56 |
+
# %lt : Tensor "b8[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg1_1, %arg3_1), kwargs = {})
|
| 57 |
+
# %bitwise_and : Tensor "b8[s15][1]cuda:7"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge, %lt), kwargs = {})
|
| 58 |
+
# %ge_1 : Tensor "b8[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg1_1, %arg4_1), kwargs = {})
|
| 59 |
+
# %lt_1 : Tensor "b8[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg1_1, %arg5_1), kwargs = {})
|
| 60 |
+
# %bitwise_and_1 : Tensor "b8[s15][1]cuda:7"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge_1, %lt_1), kwargs = {})
|
| 61 |
+
# %bitwise_or : Tensor "b8[s15][1]cuda:7"[num_users=2] = call_function[target=torch.ops.aten.bitwise_or.Tensor](args = (%bitwise_and, %bitwise_and_1), kwargs = {})
|
| 62 |
+
# %mul : Tensor "i64[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_and, %arg2_1), kwargs = {})
|
| 63 |
+
# %mul_2 : Tensor "i64[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_and_1, %sub_8), kwargs = {})
|
| 64 |
+
# %add_16 : Tensor "i64[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul, %mul_2), kwargs = {})
|
| 65 |
+
# %sub_13 : Tensor "i64[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg1_1, %add_16), kwargs = {})
|
| 66 |
+
# %mul_6 : Tensor "i64[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_or, %sub_13), kwargs = {})
|
| 67 |
+
# %bitwise_not : Tensor "b8[s15][1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.bitwise_not.default](args = (%bitwise_or,), kwargs = {})
|
| 68 |
+
# return %mul_6,%bitwise_not
|
| 69 |
+
triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0 = async_compile.triton('triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0', '''
|
| 70 |
+
import triton
|
| 71 |
+
import triton.language as tl
|
| 72 |
+
|
| 73 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 74 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 75 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 76 |
+
triton_helpers.set_driver_to_gpu()
|
| 77 |
+
|
| 78 |
+
@triton_heuristics.pointwise(
|
| 79 |
+
size_hints={'x': 128},
|
| 80 |
+
filename=__file__,
|
| 81 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'out_ptr1': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]]}]},
|
| 82 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 2912}},
|
| 83 |
+
min_elem_per_thread=0
|
| 84 |
+
)
|
| 85 |
+
@triton.jit
|
| 86 |
+
def triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, out_ptr1, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 87 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 88 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 89 |
+
xmask = xindex < xnumel
|
| 90 |
+
x0 = xindex
|
| 91 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 92 |
+
tmp1 = ks0
|
| 93 |
+
tmp2 = tmp0 >= tmp1
|
| 94 |
+
tmp3 = ks1
|
| 95 |
+
tmp4 = tmp0 < tmp3
|
| 96 |
+
tmp5 = tmp2 & tmp4
|
| 97 |
+
tmp6 = ks2
|
| 98 |
+
tmp7 = tmp0 >= tmp6
|
| 99 |
+
tmp8 = ks3
|
| 100 |
+
tmp9 = tmp0 < tmp8
|
| 101 |
+
tmp10 = tmp7 & tmp9
|
| 102 |
+
tmp11 = tmp5 | tmp10
|
| 103 |
+
tmp12 = tmp11.to(tl.int64)
|
| 104 |
+
tmp13 = tmp5.to(tl.int64)
|
| 105 |
+
tmp14 = tmp13 * tmp1
|
| 106 |
+
tmp15 = tmp10.to(tl.int64)
|
| 107 |
+
tmp16 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 108 |
+
tmp17 = tmp15 * tmp16
|
| 109 |
+
tmp18 = tmp14 + tmp17
|
| 110 |
+
tmp19 = tmp0 - tmp18
|
| 111 |
+
tmp20 = tmp12 * tmp19
|
| 112 |
+
tmp21 = tmp11 == 0
|
| 113 |
+
tl.store(out_ptr0 + (x0), tmp20, xmask)
|
| 114 |
+
tl.store(out_ptr1 + (x0), tmp21, xmask)
|
| 115 |
+
''', device_str='cuda')
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
async_compile.wait(globals())
|
| 119 |
+
del async_compile
|
| 120 |
+
|
| 121 |
+
class Runner:
|
| 122 |
+
def __init__(self, partitions):
|
| 123 |
+
self.partitions = partitions
|
| 124 |
+
|
| 125 |
+
def recursively_apply_fns(self, fns):
|
| 126 |
+
new_callables = []
|
| 127 |
+
for fn, c in zip(fns, self.partitions):
|
| 128 |
+
new_callables.append(fn(c))
|
| 129 |
+
self.partitions = new_callables
|
| 130 |
+
|
| 131 |
+
def call(self, args):
|
| 132 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1 = args
|
| 133 |
+
args.clear()
|
| 134 |
+
s15 = arg0_1
|
| 135 |
+
s90 = arg2_1
|
| 136 |
+
s87 = arg3_1
|
| 137 |
+
s68 = arg4_1
|
| 138 |
+
s53 = arg5_1
|
| 139 |
+
s88 = arg6_1
|
| 140 |
+
assert_size_stride(arg1_1, (s15, ), (1, ))
|
| 141 |
+
with torch.cuda._DeviceGuard(7):
|
| 142 |
+
torch.cuda.set_device(7)
|
| 143 |
+
buf0 = empty_strided_cuda((s15, ), (1, ), torch.int64)
|
| 144 |
+
buf1 = empty_strided_cuda((s15, ), (1, ), torch.bool)
|
| 145 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, mul, mul_1, valid_offset, sub_3, input_, invert], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.mul, aten.add, aten.sub, aten.bitwise_not]
|
| 146 |
+
stream7 = get_raw_stream(7)
|
| 147 |
+
triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0.run(arg1_1, buf0, buf1, s90, s87, s68, s53, s88, s15, stream=stream7)
|
| 148 |
+
del arg1_1
|
| 149 |
+
return (buf0, buf1, )
|
| 150 |
+
|
| 151 |
+
runner = Runner(partitions=[])
|
| 152 |
+
call = runner.call
|
| 153 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def get_args():
|
| 157 |
+
from torch._dynamo.testing import rand_strided
|
| 158 |
+
arg0_1 = 112
|
| 159 |
+
arg1_1 = rand_strided((112, ), (1, ), device='cuda:7', dtype=torch.int64)
|
| 160 |
+
arg2_1 = 135520
|
| 161 |
+
arg3_1 = 154880
|
| 162 |
+
arg4_1 = 154880
|
| 163 |
+
arg5_1 = 154880
|
| 164 |
+
arg6_1 = 0
|
| 165 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1]
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 169 |
+
from torch._inductor.utils import print_performance
|
| 170 |
+
fn = lambda: call(list(args))
|
| 171 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__":
|
| 175 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 176 |
+
args = get_args()
|
| 177 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/4b/c4bzcwru43j45mp2ej3abi6jtvpi4pqeiwedj4gy3vcydr2jkwun.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['6_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/pq/cpqfafvbzdc4yv5hpjbitcl5zsctcve7hn6ahg66aj4blq3vprf6.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s97, 1][1, 1]cuda:5" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg3_1 : Tensor "f32[s97, 1][1, 1]cuda:5" = PlaceHolder[target=arg3_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:5" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg3_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:5"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 8},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/zb/czbs2fm46j6qhtd2znnofgeavkuhyl72vdcahggz7dhvxp5zvnma.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg4_1 : Tensor "i64[s97, 1][1, 1]cuda:5" = PlaceHolder[target=arg4_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg4_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 8},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/zm/czmqgy6soqztyipifu6p2jfwi4je2rv5dgpxsqvvy3vdykavyemd.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg6_1 : Tensor "bf16[s97, s87][s87, 1]cuda:5" = PlaceHolder[target=arg6_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s97][1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg1_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s97][1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s97][1]cuda:5"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg1_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:5, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s97][1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg1_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s97][1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s97, s87][s87, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg6_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 65536},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 294912}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/mz/cmzyybpwh6qmtcq7gwcqgwbieukiskiqslaso7ig7lcotivioxzy.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s97, 1][1, 1]cuda:5"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg7_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 8},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 128}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s97 = arg1_1
|
| 231 |
+
s87 = arg5_1
|
| 232 |
+
s77 = arg7_1
|
| 233 |
+
assert_size_stride(arg2_1, (s97, 1), (1, 1))
|
| 234 |
+
assert_size_stride(arg3_1, (s97, 1), (1, 1))
|
| 235 |
+
assert_size_stride(arg4_1, (s97, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg6_1, (s97, s87), (s87, 1))
|
| 237 |
+
with torch.cuda._DeviceGuard(5):
|
| 238 |
+
torch.cuda.set_device(5)
|
| 239 |
+
buf0 = empty_strided_cuda((s97, 1, 1), (1, 1, 1), torch.float32)
|
| 240 |
+
buf1 = empty_strided_cuda((s97, 1), (1, 1), torch.float32)
|
| 241 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 242 |
+
stream5 = get_raw_stream(5)
|
| 243 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg3_1, buf0, buf1, s97, stream=stream5)
|
| 244 |
+
del arg2_1
|
| 245 |
+
del arg3_1
|
| 246 |
+
buf2 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 247 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 248 |
+
stream5 = get_raw_stream(5)
|
| 249 |
+
triton_poi_fused_gather_max_view_1.run(arg4_1, buf2, s97, stream=stream5)
|
| 250 |
+
buf3 = empty_strided_cuda((s97, s87), (s87, 1), torch.bfloat16)
|
| 251 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 252 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s87*s97
|
| 253 |
+
stream5 = get_raw_stream(5)
|
| 254 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg6_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream5)
|
| 255 |
+
del arg6_1
|
| 256 |
+
buf4 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 257 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 258 |
+
stream5 = get_raw_stream(5)
|
| 259 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s97, stream=stream5)
|
| 260 |
+
return (reinterpret_tensor(buf2, (s97, ), (1, ), 0), buf3, buf1, buf0, arg4_1, buf4, )
|
| 261 |
+
|
| 262 |
+
runner = Runner(partitions=[])
|
| 263 |
+
call = runner.call
|
| 264 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def get_args():
|
| 268 |
+
from torch._dynamo.testing import rand_strided
|
| 269 |
+
arg0_1 = 1
|
| 270 |
+
arg1_1 = 8
|
| 271 |
+
arg2_1 = rand_strided((8, 1), (1, 1), device='cuda:5', dtype=torch.float32)
|
| 272 |
+
arg3_1 = rand_strided((8, 1), (1, 1), device='cuda:5', dtype=torch.float32)
|
| 273 |
+
arg4_1 = rand_strided((8, 1), (1, 1), device='cuda:5', dtype=torch.int64)
|
| 274 |
+
arg5_1 = 6144
|
| 275 |
+
arg6_1 = rand_strided((8, 6144), (6144, 1), device='cuda:5', dtype=torch.bfloat16)
|
| 276 |
+
arg7_1 = 1
|
| 277 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1]
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 281 |
+
from torch._inductor.utils import print_performance
|
| 282 |
+
fn = lambda: call(list(args))
|
| 283 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
if __name__ == "__main__":
|
| 287 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 288 |
+
args = get_args()
|
| 289 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/4b/c4bzoixvavbv7tbgxpx5sajtax6yl6d6wky5k272ff4wk64t7jd7.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp1, None)
|
.inductor_cache/4i/c4iwhfgin6ac7qvqb6fj5msgdftp5qsxjv6sjxyuqbryq4qqwzfg.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=6, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = ks0
|
| 26 |
+
tmp3 = tmp1 >= tmp2
|
| 27 |
+
tmp4 = ks1
|
| 28 |
+
tmp5 = tmp1 < tmp4
|
| 29 |
+
tmp6 = tmp3 & tmp5
|
| 30 |
+
tmp7 = ks2
|
| 31 |
+
tmp8 = tmp1 >= tmp7
|
| 32 |
+
tmp9 = ks3
|
| 33 |
+
tmp10 = tmp1 < tmp9
|
| 34 |
+
tmp11 = tmp8 & tmp10
|
| 35 |
+
tmp12 = tmp6 | tmp11
|
| 36 |
+
tmp13 = tmp12 == 0
|
| 37 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp13, None)
|
.inductor_cache/4l/c4ljp5q37q7ktbyo35672uzle4llt4iwt4be37ikkwlit6j7fnco.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 2048},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 28672}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 25 |
+
tmp5 = in_ptr1
|
| 26 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 27 |
+
tmp2 = tmp0 * tmp1
|
| 28 |
+
tmp4 = tmp2 * tmp3
|
| 29 |
+
tmp6 = tmp5.to(tl.float32)
|
| 30 |
+
tmp7 = tmp4 * tmp6
|
| 31 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
.inductor_cache/4l/dccab99d67a1299427a9211bfd01fd3c77aaa44ad59d9ffa12a6d00f48a13c0e.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 48, "triton_cache_hash": "KGGY5WAIFCN23ENKRQFNT2OZB6CJLZGZIIMD5KHX6XAEJ3DEY7VA"}
|
.inductor_cache/4n/c4nxaenxhyi2kg2uordabgcp5ofkprcosqtxys5klrlaly24kcgm.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['13_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/qd/cqdull3kwipr33yws7qnj6z4jsiuvue3qmvlqyhxb6q2tawpraqz.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s0, 1][1, 1]cuda:3" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg4_1 : Tensor "f32[s0, 1][1, 1]cuda:3" = PlaceHolder[target=arg4_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:3" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg4_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s0, 1, 1][1, 1, 1]cuda:3"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 2},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/sm/csmhkmklmfo5h4gcgl6wazfjapbn6edilhx43by42rcvlwmhrmz6.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg6_1 : Tensor "i64[s37, 1][1, 1]cuda:3" = PlaceHolder[target=arg6_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg6_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 2},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/bu/cburtb54dxftz4ovx6wqbvnuvsq4klzrlfgkq2xyomwqr45boyxv.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg8_1 : Tensor "bf16[s0, s87][s87, 1]cuda:3" = PlaceHolder[target=arg8_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s0][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg3_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s0][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s0][1]cuda:3"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg3_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:3, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s0][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg3_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s0][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s0, s87][s87, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg8_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 16384},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 73728}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/ub/cubrga4p6slgmvpkerkbtbebckik3kdln7y7xyo466mbcclx3vly.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg3_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s0, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg9_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 2},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 8}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s68 = arg1_1
|
| 231 |
+
s0 = arg3_1
|
| 232 |
+
s37 = arg5_1
|
| 233 |
+
s87 = arg7_1
|
| 234 |
+
s77 = arg9_1
|
| 235 |
+
assert_size_stride(arg2_1, (s0, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg4_1, (s0, 1), (1, 1))
|
| 237 |
+
assert_size_stride(arg6_1, (s37, 1), (1, 1))
|
| 238 |
+
assert_size_stride(arg8_1, (s0, s87), (s87, 1))
|
| 239 |
+
with torch.cuda._DeviceGuard(3):
|
| 240 |
+
torch.cuda.set_device(3)
|
| 241 |
+
buf0 = empty_strided_cuda((s0, 1, 1), (1, 1, 1), torch.float32)
|
| 242 |
+
buf1 = empty_strided_cuda((s0, 1), (1, 1), torch.float32)
|
| 243 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 244 |
+
stream3 = get_raw_stream(3)
|
| 245 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg4_1, buf0, buf1, s0, stream=stream3)
|
| 246 |
+
del arg2_1
|
| 247 |
+
del arg4_1
|
| 248 |
+
buf2 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 249 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 250 |
+
stream3 = get_raw_stream(3)
|
| 251 |
+
triton_poi_fused_gather_max_view_1.run(arg6_1, buf2, s0, stream=stream3)
|
| 252 |
+
buf3 = empty_strided_cuda((s0, s87), (s87, 1), torch.bfloat16)
|
| 253 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 254 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s0*s87
|
| 255 |
+
stream3 = get_raw_stream(3)
|
| 256 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg8_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream3)
|
| 257 |
+
del arg8_1
|
| 258 |
+
buf4 = empty_strided_cuda((s0, 1), (1, 1), torch.int64)
|
| 259 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 260 |
+
stream3 = get_raw_stream(3)
|
| 261 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s0, stream=stream3)
|
| 262 |
+
return (reinterpret_tensor(buf2, (s0, ), (1, ), 0), buf3, buf1, buf0, arg6_1, buf4, )
|
| 263 |
+
|
| 264 |
+
runner = Runner(partitions=[])
|
| 265 |
+
call = runner.call
|
| 266 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def get_args():
|
| 270 |
+
from torch._dynamo.testing import rand_strided
|
| 271 |
+
arg0_1 = 1
|
| 272 |
+
arg1_1 = 2
|
| 273 |
+
arg2_1 = rand_strided((2, 1), (1, 1), device='cuda:3', dtype=torch.float32)
|
| 274 |
+
arg3_1 = 2
|
| 275 |
+
arg4_1 = rand_strided((2, 1), (1, 1), device='cuda:3', dtype=torch.float32)
|
| 276 |
+
arg5_1 = 2
|
| 277 |
+
arg6_1 = rand_strided((2, 1), (1, 1), device='cuda:3', dtype=torch.int64)
|
| 278 |
+
arg7_1 = 6144
|
| 279 |
+
arg8_1 = rand_strided((2, 6144), (6144, 1), device='cuda:3', dtype=torch.bfloat16)
|
| 280 |
+
arg9_1 = 1
|
| 281 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1, arg8_1, arg9_1]
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 285 |
+
from torch._inductor.utils import print_performance
|
| 286 |
+
fn = lambda: call(list(args))
|
| 287 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
if __name__ == "__main__":
|
| 291 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 292 |
+
args = get_args()
|
| 293 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/4w/88c2a3ee4b3f9188d0485d1f58c19da2936d66802465a9e388f74d179d8ec54e.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 83, "triton_cache_hash": "K7P5VUQTWQ2GR5KCWBMAJUJLJ4ZOKI2HSLQM523UQ5RBJFUB5GQA"}
|
.inductor_cache/4w/c4wbe3nz76vrohi4tguyhvtuuwxq5ot6a6vjcubrww3al5ynrkzg.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 256},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 3072}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_0(in_out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 25 |
+
tmp2 = tmp0 * tmp1
|
| 26 |
+
tl.store(in_out_ptr0 + (x0), tmp2, xmask)
|
.inductor_cache/5d/c5dllvj5zhsrbv5yhs4lnnrfdo5t7vsfkgewb73jsq5ipppt5rbn.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = ks0
|
| 26 |
+
tmp3 = tmp1 >= tmp2
|
| 27 |
+
tmp4 = ks1
|
| 28 |
+
tmp5 = tmp1 < tmp4
|
| 29 |
+
tmp6 = tmp3 & tmp5
|
| 30 |
+
tmp7 = ks2
|
| 31 |
+
tmp8 = tmp1 >= tmp7
|
| 32 |
+
tmp9 = ks3
|
| 33 |
+
tmp10 = tmp1 < tmp9
|
| 34 |
+
tmp11 = tmp8 & tmp10
|
| 35 |
+
tmp12 = tmp6 | tmp11
|
| 36 |
+
tmp13 = tmp12 == 0
|
| 37 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp13, None)
|
.inductor_cache/5f/c5fm757ws5k72edgygk6waomo4dh4sqhl7n4rzqsynjfqrzjugov.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['3_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/6d/c6dqripf2w5j4sf6yps4zy7tc4ifqtp2wzcncsdxelw7lhj3o7ou.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul_1 => mul_7
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# weights_1 => mul_2
|
| 43 |
+
# Graph fragment:
|
| 44 |
+
# %mm : Tensor "f32[s0, 32][32, 1]cuda:3" = PlaceHolder[target=mm]
|
| 45 |
+
# %arg3_1 : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:3" = PlaceHolder[target=arg3_1]
|
| 46 |
+
# %arg4_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg4_1]
|
| 47 |
+
# %mul_2 : Tensor "f32[s0, 32][32, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mm, 0.1767766952966369), kwargs = {})
|
| 48 |
+
# %unsqueeze : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%mul_2, -1), kwargs = {})
|
| 49 |
+
# %mul_7 : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg3_1), kwargs = {})
|
| 50 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg4_1, torch.float32), kwargs = {})
|
| 51 |
+
# %mul_tensor : Tensor "f32[s0, 32, 1][32, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_7, %convert_element_type_default_1), kwargs = {})
|
| 52 |
+
# return %mul_tensor
|
| 53 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 54 |
+
import triton
|
| 55 |
+
import triton.language as tl
|
| 56 |
+
|
| 57 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 58 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 59 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 60 |
+
triton_helpers.set_driver_to_gpu()
|
| 61 |
+
|
| 62 |
+
@triton_heuristics.pointwise(
|
| 63 |
+
size_hints={'x': 2048},
|
| 64 |
+
filename=__file__,
|
| 65 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 66 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 28672}},
|
| 67 |
+
min_elem_per_thread=0
|
| 68 |
+
)
|
| 69 |
+
@triton.jit
|
| 70 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 71 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 72 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 73 |
+
xmask = xindex < xnumel
|
| 74 |
+
x0 = xindex
|
| 75 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 76 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 77 |
+
tmp5 = in_ptr1
|
| 78 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 79 |
+
tmp2 = tmp0 * tmp1
|
| 80 |
+
tmp4 = tmp2 * tmp3
|
| 81 |
+
tmp6 = tmp5.to(tl.float32)
|
| 82 |
+
tmp7 = tmp4 * tmp6
|
| 83 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
| 84 |
+
''', device_str='cuda')
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
async_compile.wait(globals())
|
| 88 |
+
del async_compile
|
| 89 |
+
|
| 90 |
+
class Runner:
|
| 91 |
+
def __init__(self, partitions):
|
| 92 |
+
self.partitions = partitions
|
| 93 |
+
|
| 94 |
+
def recursively_apply_fns(self, fns):
|
| 95 |
+
new_callables = []
|
| 96 |
+
for fn, c in zip(fns, self.partitions):
|
| 97 |
+
new_callables.append(fn(c))
|
| 98 |
+
self.partitions = new_callables
|
| 99 |
+
|
| 100 |
+
def call(self, args):
|
| 101 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
|
| 102 |
+
args.clear()
|
| 103 |
+
s77 = arg1_1
|
| 104 |
+
arg2_1_size = arg2_1.size()
|
| 105 |
+
s0 = arg2_1_size[0]
|
| 106 |
+
assert_size_stride(arg0_1, (32, 6144), (6144, 1))
|
| 107 |
+
assert_size_stride(arg2_1, (s0, 6144), (6144, 1))
|
| 108 |
+
assert_size_stride(arg3_1, (s0, 32, 1), (32, 1, 1))
|
| 109 |
+
assert_size_stride(arg4_1, (), ())
|
| 110 |
+
with torch.cuda._DeviceGuard(3):
|
| 111 |
+
torch.cuda.set_device(3)
|
| 112 |
+
buf0 = empty_strided_cuda((s0, 32), (32, 1), torch.float32)
|
| 113 |
+
# Topologically Sorted Source Nodes: [t, weights], Original ATen: [aten.t, aten.mm]
|
| 114 |
+
extern_kernels.mm_dtype(arg2_1, reinterpret_tensor(arg0_1, (6144, 32), (1, 6144), 0), out_dtype=torch.float32, out=buf0)
|
| 115 |
+
del arg0_1
|
| 116 |
+
del arg2_1
|
| 117 |
+
buf1 = reinterpret_tensor(buf0, (s0, 32, 1), (32, 1, 1), 0); del buf0 # reuse
|
| 118 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 119 |
+
triton_poi_fused_mul_unsqueeze_0_xnumel = 32*s0
|
| 120 |
+
stream3 = get_raw_stream(3)
|
| 121 |
+
triton_poi_fused_mul_unsqueeze_0.run(buf1, arg3_1, arg4_1.item(), triton_poi_fused_mul_unsqueeze_0_xnumel, stream=stream3)
|
| 122 |
+
del arg3_1
|
| 123 |
+
del arg4_1
|
| 124 |
+
return (buf1, )
|
| 125 |
+
|
| 126 |
+
runner = Runner(partitions=[])
|
| 127 |
+
call = runner.call
|
| 128 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def get_args():
|
| 132 |
+
from torch._dynamo.testing import rand_strided
|
| 133 |
+
arg0_1 = rand_strided((32, 6144), (6144, 1), device='cuda:3', dtype=torch.bfloat16)
|
| 134 |
+
arg1_1 = 56
|
| 135 |
+
arg2_1 = rand_strided((56, 6144), (6144, 1), device='cuda:3', dtype=torch.bfloat16)
|
| 136 |
+
arg3_1 = rand_strided((56, 32, 1), (32, 1, 1), device='cuda:3', dtype=torch.float32)
|
| 137 |
+
arg4_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 138 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1]
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 142 |
+
from torch._inductor.utils import print_performance
|
| 143 |
+
fn = lambda: call(list(args))
|
| 144 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
if __name__ == "__main__":
|
| 148 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 149 |
+
args = get_args()
|
| 150 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/5l/c5lhmqi55bmiwxrtdbnsnvjgutkpxgsd6sl2mrliaofj5ojwc2gs.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = ks0
|
| 24 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32)), tmp0, None)
|
.inductor_cache/5p/c5pplmatftc6r3hsuhx4skgsikwfs4k4t74mko7xfk7xp2sqleis.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 128},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'out_ptr1': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 2912}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, out_ptr1, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = ks0
|
| 25 |
+
tmp2 = tmp0 >= tmp1
|
| 26 |
+
tmp3 = ks1
|
| 27 |
+
tmp4 = tmp0 < tmp3
|
| 28 |
+
tmp5 = tmp2 & tmp4
|
| 29 |
+
tmp6 = ks2
|
| 30 |
+
tmp7 = tmp0 >= tmp6
|
| 31 |
+
tmp8 = ks3
|
| 32 |
+
tmp9 = tmp0 < tmp8
|
| 33 |
+
tmp10 = tmp7 & tmp9
|
| 34 |
+
tmp11 = tmp5 | tmp10
|
| 35 |
+
tmp12 = tmp11.to(tl.int64)
|
| 36 |
+
tmp13 = tmp5.to(tl.int64)
|
| 37 |
+
tmp14 = tmp13 * tmp1
|
| 38 |
+
tmp15 = tmp10.to(tl.int64)
|
| 39 |
+
tmp16 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 40 |
+
tmp17 = tmp15 * tmp16
|
| 41 |
+
tmp18 = tmp14 + tmp17
|
| 42 |
+
tmp19 = tmp0 - tmp18
|
| 43 |
+
tmp20 = tmp12 * tmp19
|
| 44 |
+
tmp21 = tmp11 == 0
|
| 45 |
+
tl.store(out_ptr0 + (x0), tmp20, xmask)
|
| 46 |
+
tl.store(out_ptr1 + (x0), tmp21, xmask)
|
.inductor_cache/5q/c5qdusbmow5b3zrnnn4oh343d7oyptsndbeaenzknk5r4mhn7org.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['1_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/bk/cbk2gyqxm7qwcf2a3uzdxgrzshzr3heruzlee42ped765ktbbc6f.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# mul_1 => mul_7
|
| 41 |
+
# unsqueeze => unsqueeze
|
| 42 |
+
# weights_1 => mul_2
|
| 43 |
+
# Graph fragment:
|
| 44 |
+
# %mm : Tensor "f32[s77, 32][32, 1]cuda:7" = PlaceHolder[target=mm]
|
| 45 |
+
# %arg3_1 : Tensor "f32[s77, 32, 1][32, 1, 1]cuda:7" = PlaceHolder[target=arg3_1]
|
| 46 |
+
# %arg4_1 : Tensor "f64[][]cpu" = PlaceHolder[target=arg4_1]
|
| 47 |
+
# %mul_2 : Tensor "f32[s77, 32][32, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mm, 0.1767766952966369), kwargs = {})
|
| 48 |
+
# %unsqueeze : Tensor "f32[s77, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%mul_2, -1), kwargs = {})
|
| 49 |
+
# %mul_7 : Tensor "f32[s77, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %arg3_1), kwargs = {})
|
| 50 |
+
# %convert_element_type_default_1 : Tensor "f32[][]cpu"[num_users=1] = call_function[target=torch.ops.prims.convert_element_type.default](args = (%arg4_1, torch.float32), kwargs = {})
|
| 51 |
+
# %mul_tensor : Tensor "f32[s77, 32, 1][32, 1, 1]cuda:7"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_7, %convert_element_type_default_1), kwargs = {})
|
| 52 |
+
# return %mul_tensor
|
| 53 |
+
triton_poi_fused_mul_unsqueeze_0 = async_compile.triton('triton_poi_fused_mul_unsqueeze_0', '''
|
| 54 |
+
import triton
|
| 55 |
+
import triton.language as tl
|
| 56 |
+
|
| 57 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 58 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 59 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 60 |
+
triton_helpers.set_driver_to_gpu()
|
| 61 |
+
|
| 62 |
+
@triton_heuristics.pointwise(
|
| 63 |
+
size_hints={'x': 4096},
|
| 64 |
+
filename=__file__,
|
| 65 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 66 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 57344}},
|
| 67 |
+
min_elem_per_thread=0
|
| 68 |
+
)
|
| 69 |
+
@triton.jit
|
| 70 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 71 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 72 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 73 |
+
xmask = xindex < xnumel
|
| 74 |
+
x0 = xindex
|
| 75 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 76 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 77 |
+
tmp5 = in_ptr1
|
| 78 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 79 |
+
tmp2 = tmp0 * tmp1
|
| 80 |
+
tmp4 = tmp2 * tmp3
|
| 81 |
+
tmp6 = tmp5.to(tl.float32)
|
| 82 |
+
tmp7 = tmp4 * tmp6
|
| 83 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
| 84 |
+
''', device_str='cuda')
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
async_compile.wait(globals())
|
| 88 |
+
del async_compile
|
| 89 |
+
|
| 90 |
+
class Runner:
|
| 91 |
+
def __init__(self, partitions):
|
| 92 |
+
self.partitions = partitions
|
| 93 |
+
|
| 94 |
+
def recursively_apply_fns(self, fns):
|
| 95 |
+
new_callables = []
|
| 96 |
+
for fn, c in zip(fns, self.partitions):
|
| 97 |
+
new_callables.append(fn(c))
|
| 98 |
+
self.partitions = new_callables
|
| 99 |
+
|
| 100 |
+
def call(self, args):
|
| 101 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
|
| 102 |
+
args.clear()
|
| 103 |
+
s77 = arg1_1
|
| 104 |
+
assert_size_stride(arg0_1, (32, 6144), (6144, 1))
|
| 105 |
+
assert_size_stride(arg2_1, (s77, 6144), (6144, 1))
|
| 106 |
+
assert_size_stride(arg3_1, (s77, 32, 1), (32, 1, 1))
|
| 107 |
+
assert_size_stride(arg4_1, (), ())
|
| 108 |
+
with torch.cuda._DeviceGuard(7):
|
| 109 |
+
torch.cuda.set_device(7)
|
| 110 |
+
buf0 = empty_strided_cuda((s77, 32), (32, 1), torch.float32)
|
| 111 |
+
# Topologically Sorted Source Nodes: [t, weights], Original ATen: [aten.t, aten.mm]
|
| 112 |
+
extern_kernels.mm_dtype(arg2_1, reinterpret_tensor(arg0_1, (6144, 32), (1, 6144), 0), out_dtype=torch.float32, out=buf0)
|
| 113 |
+
del arg0_1
|
| 114 |
+
del arg2_1
|
| 115 |
+
buf1 = reinterpret_tensor(buf0, (s77, 32, 1), (32, 1, 1), 0); del buf0 # reuse
|
| 116 |
+
# Topologically Sorted Source Nodes: [weights_1, unsqueeze, mul_1], Original ATen: [aten.mul, aten.unsqueeze]
|
| 117 |
+
triton_poi_fused_mul_unsqueeze_0_xnumel = 32*s77
|
| 118 |
+
stream7 = get_raw_stream(7)
|
| 119 |
+
triton_poi_fused_mul_unsqueeze_0.run(buf1, arg3_1, arg4_1.item(), triton_poi_fused_mul_unsqueeze_0_xnumel, stream=stream7)
|
| 120 |
+
del arg3_1
|
| 121 |
+
del arg4_1
|
| 122 |
+
return (buf1, )
|
| 123 |
+
|
| 124 |
+
runner = Runner(partitions=[])
|
| 125 |
+
call = runner.call
|
| 126 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def get_args():
|
| 130 |
+
from torch._dynamo.testing import rand_strided
|
| 131 |
+
arg0_1 = rand_strided((32, 6144), (6144, 1), device='cuda:7', dtype=torch.bfloat16)
|
| 132 |
+
arg1_1 = 112
|
| 133 |
+
arg2_1 = rand_strided((112, 6144), (6144, 1), device='cuda:7', dtype=torch.bfloat16)
|
| 134 |
+
arg3_1 = rand_strided((112, 32, 1), (32, 1, 1), device='cuda:7', dtype=torch.float32)
|
| 135 |
+
arg4_1 = rand_strided((), (), device='cpu', dtype=torch.float64)
|
| 136 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1]
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 140 |
+
from torch._inductor.utils import print_performance
|
| 141 |
+
fn = lambda: call(list(args))
|
| 142 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
if __name__ == "__main__":
|
| 146 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 147 |
+
args = get_args()
|
| 148 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/5s/c5s4bm2q3gua3tgmxnj3denzqvuhpgrb5kx5rjwxxb4isc7lmqaz.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 2},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 8}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = ks0
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
.inductor_cache/5v/1eb21a9ba8eeb898c12aad6f0c7f6fb253af198de2a96f9596a41157018121fd.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 128, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 49, "triton_cache_hash": "XSMSLG6JQYYM2VVQRQ2PIUDTYEQTGTTF7NZPLRX5QSBQLLXPCRSA"}
|
.inductor_cache/5v/c5vsrxfkmbxmqe35ujjlxyr37blswcxqhqzlv2r6jal54yzc27hf.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 4096},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 57344}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 25 |
+
tmp5 = in_ptr1
|
| 26 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 27 |
+
tmp2 = tmp0 * tmp1
|
| 28 |
+
tmp4 = tmp2 * tmp3
|
| 29 |
+
tmp6 = tmp5.to(tl.float32)
|
| 30 |
+
tmp7 = tmp4 * tmp6
|
| 31 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
.inductor_cache/5z/c5ztwyl3hjethlv2ot2kpnvlbaqjstzofdcjttbjwa7nkglx5gan.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = ks0
|
| 26 |
+
tmp3 = tmp1 >= tmp2
|
| 27 |
+
tmp4 = ks1
|
| 28 |
+
tmp5 = tmp1 < tmp4
|
| 29 |
+
tmp6 = tmp3 & tmp5
|
| 30 |
+
tmp7 = ks2
|
| 31 |
+
tmp8 = tmp1 >= tmp7
|
| 32 |
+
tmp9 = ks3
|
| 33 |
+
tmp10 = tmp1 < tmp9
|
| 34 |
+
tmp11 = tmp8 & tmp10
|
| 35 |
+
tmp12 = tmp6 | tmp11
|
| 36 |
+
tmp13 = tmp12.to(tl.int64)
|
| 37 |
+
tmp14 = tmp6.to(tl.int64)
|
| 38 |
+
tmp15 = tmp14 * tmp2
|
| 39 |
+
tmp16 = tmp11.to(tl.int64)
|
| 40 |
+
tmp17 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 41 |
+
tmp18 = tmp16 * tmp17
|
| 42 |
+
tmp19 = tmp15 + tmp18
|
| 43 |
+
tmp20 = tmp1 - tmp19
|
| 44 |
+
tmp21 = tmp13 * tmp20
|
| 45 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp21, None)
|
.inductor_cache/62/c62vhrldvf7yqvelctjx64ts5ifznauctxiqhwo4jrqxe2rtpdgj.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = ks0
|
| 26 |
+
tmp3 = tmp1 >= tmp2
|
| 27 |
+
tmp4 = ks1
|
| 28 |
+
tmp5 = tmp1 < tmp4
|
| 29 |
+
tmp6 = tmp3 & tmp5
|
| 30 |
+
tmp7 = ks2
|
| 31 |
+
tmp8 = tmp1 >= tmp7
|
| 32 |
+
tmp9 = ks3
|
| 33 |
+
tmp10 = tmp1 < tmp9
|
| 34 |
+
tmp11 = tmp8 & tmp10
|
| 35 |
+
tmp12 = tmp6 | tmp11
|
| 36 |
+
tmp13 = tmp12 == 0
|
| 37 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp13, None)
|
.inductor_cache/65/c156cdb4f80a03134d5d44666437b38d33a91660ba036c9600b2b2dad614b347.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 128, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 21, "triton_cache_hash": "Q2N5PO2YINGSELIO3M4VOOWLWHTNDJUQK2K7ETAZL7ECQK6GFLMA"}
|
.inductor_cache/65/c657qxcjufcctv3zrgtm2r3tsalyqcuqrzgzqct6qvtmivqg7fnt.py
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['8_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/6e/c6emtbesfuldnxatnjaketbq4pjgfhpuh5rpsfrb6iagv4wjnfal.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, mul, mul_1, valid_offset, sub_3, input_], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.mul, aten.add, aten.sub]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# added_vocab_mask => bitwise_and_1
|
| 41 |
+
# ge => ge
|
| 42 |
+
# ge_1 => ge_1
|
| 43 |
+
# input_ => mul_2
|
| 44 |
+
# lt => lt
|
| 45 |
+
# lt_1 => lt_1
|
| 46 |
+
# mul => mul
|
| 47 |
+
# mul_1 => mul_1
|
| 48 |
+
# org_vocab_mask => bitwise_and
|
| 49 |
+
# sub_3 => sub_3
|
| 50 |
+
# valid_offset => add
|
| 51 |
+
# vocab_mask => bitwise_or
|
| 52 |
+
# Graph fragment:
|
| 53 |
+
# %arg0_1 : Tensor "i64[1][1]cuda:4" = PlaceHolder[target=arg0_1]
|
| 54 |
+
# %ge : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg0_1, %arg1_1), kwargs = {})
|
| 55 |
+
# %lt : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg0_1, %arg2_1), kwargs = {})
|
| 56 |
+
# %bitwise_and : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge, %lt), kwargs = {})
|
| 57 |
+
# %ge_1 : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg0_1, %arg3_1), kwargs = {})
|
| 58 |
+
# %lt_1 : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg0_1, %arg4_1), kwargs = {})
|
| 59 |
+
# %bitwise_and_1 : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge_1, %lt_1), kwargs = {})
|
| 60 |
+
# %bitwise_or : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_or.Tensor](args = (%bitwise_and, %bitwise_and_1), kwargs = {})
|
| 61 |
+
# %mul : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_and, %arg1_1), kwargs = {})
|
| 62 |
+
# %mul_1 : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_and_1, %sub_2), kwargs = {})
|
| 63 |
+
# %add : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul, %mul_1), kwargs = {})
|
| 64 |
+
# %sub_3 : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add), kwargs = {})
|
| 65 |
+
# %mul_2 : Tensor "i64[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%bitwise_or, %sub_3), kwargs = {})
|
| 66 |
+
# return %mul_2
|
| 67 |
+
triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0 = async_compile.triton('triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0', '''
|
| 68 |
+
import triton
|
| 69 |
+
import triton.language as tl
|
| 70 |
+
|
| 71 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 72 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 73 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 74 |
+
triton_helpers.set_driver_to_gpu()
|
| 75 |
+
|
| 76 |
+
@triton_heuristics.pointwise(
|
| 77 |
+
size_hints={'x': 1},
|
| 78 |
+
filename=__file__,
|
| 79 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 80 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 81 |
+
min_elem_per_thread=0
|
| 82 |
+
)
|
| 83 |
+
@triton.jit
|
| 84 |
+
def triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 85 |
+
xnumel = 1
|
| 86 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 87 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 88 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 89 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 90 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 91 |
+
tmp2 = ks0
|
| 92 |
+
tmp3 = tmp1 >= tmp2
|
| 93 |
+
tmp4 = ks1
|
| 94 |
+
tmp5 = tmp1 < tmp4
|
| 95 |
+
tmp6 = tmp3 & tmp5
|
| 96 |
+
tmp7 = ks2
|
| 97 |
+
tmp8 = tmp1 >= tmp7
|
| 98 |
+
tmp9 = ks3
|
| 99 |
+
tmp10 = tmp1 < tmp9
|
| 100 |
+
tmp11 = tmp8 & tmp10
|
| 101 |
+
tmp12 = tmp6 | tmp11
|
| 102 |
+
tmp13 = tmp12.to(tl.int64)
|
| 103 |
+
tmp14 = tmp6.to(tl.int64)
|
| 104 |
+
tmp15 = tmp14 * tmp2
|
| 105 |
+
tmp16 = tmp11.to(tl.int64)
|
| 106 |
+
tmp17 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 107 |
+
tmp18 = tmp16 * tmp17
|
| 108 |
+
tmp19 = tmp15 + tmp18
|
| 109 |
+
tmp20 = tmp1 - tmp19
|
| 110 |
+
tmp21 = tmp13 * tmp20
|
| 111 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp21, None)
|
| 112 |
+
''', device_str='cuda')
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/ck/cck7lywyewjkzmkn5tgb3zgvxscxs7idurr7myyeg2z5dguv75br.py
|
| 116 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, invert], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.bitwise_not]
|
| 117 |
+
# Source node to ATen node mapping:
|
| 118 |
+
# added_vocab_mask => bitwise_and_1
|
| 119 |
+
# ge => ge
|
| 120 |
+
# ge_1 => ge_1
|
| 121 |
+
# invert => bitwise_not
|
| 122 |
+
# lt => lt
|
| 123 |
+
# lt_1 => lt_1
|
| 124 |
+
# org_vocab_mask => bitwise_and
|
| 125 |
+
# vocab_mask => bitwise_or
|
| 126 |
+
# Graph fragment:
|
| 127 |
+
# %arg0_1 : Tensor "i64[1][1]cuda:4" = PlaceHolder[target=arg0_1]
|
| 128 |
+
# %ge : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg0_1, %arg1_1), kwargs = {})
|
| 129 |
+
# %lt : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg0_1, %arg2_1), kwargs = {})
|
| 130 |
+
# %bitwise_and : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge, %lt), kwargs = {})
|
| 131 |
+
# %ge_1 : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.ge.Scalar](args = (%arg0_1, %arg3_1), kwargs = {})
|
| 132 |
+
# %lt_1 : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.lt.Scalar](args = (%arg0_1, %arg4_1), kwargs = {})
|
| 133 |
+
# %bitwise_and_1 : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_and.Tensor](args = (%ge_1, %lt_1), kwargs = {})
|
| 134 |
+
# %bitwise_or : Tensor "b8[1][1]cuda:4"[num_users=2] = call_function[target=torch.ops.aten.bitwise_or.Tensor](args = (%bitwise_and, %bitwise_and_1), kwargs = {})
|
| 135 |
+
# %bitwise_not : Tensor "b8[1][1]cuda:4"[num_users=1] = call_function[target=torch.ops.aten.bitwise_not.default](args = (%bitwise_or,), kwargs = {})
|
| 136 |
+
# return %bitwise_not
|
| 137 |
+
triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1 = async_compile.triton('triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1', '''
|
| 138 |
+
import triton
|
| 139 |
+
import triton.language as tl
|
| 140 |
+
|
| 141 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 142 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 143 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 144 |
+
triton_helpers.set_driver_to_gpu()
|
| 145 |
+
|
| 146 |
+
@triton_heuristics.pointwise(
|
| 147 |
+
size_hints={'x': 1},
|
| 148 |
+
filename=__file__,
|
| 149 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 150 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 151 |
+
min_elem_per_thread=0
|
| 152 |
+
)
|
| 153 |
+
@triton.jit
|
| 154 |
+
def triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, xnumel, XBLOCK : tl.constexpr):
|
| 155 |
+
xnumel = 1
|
| 156 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 157 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 158 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 159 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 160 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 161 |
+
tmp2 = ks0
|
| 162 |
+
tmp3 = tmp1 >= tmp2
|
| 163 |
+
tmp4 = ks1
|
| 164 |
+
tmp5 = tmp1 < tmp4
|
| 165 |
+
tmp6 = tmp3 & tmp5
|
| 166 |
+
tmp7 = ks2
|
| 167 |
+
tmp8 = tmp1 >= tmp7
|
| 168 |
+
tmp9 = ks3
|
| 169 |
+
tmp10 = tmp1 < tmp9
|
| 170 |
+
tmp11 = tmp8 & tmp10
|
| 171 |
+
tmp12 = tmp6 | tmp11
|
| 172 |
+
tmp13 = tmp12 == 0
|
| 173 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp13, None)
|
| 174 |
+
''', device_str='cuda')
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
async_compile.wait(globals())
|
| 178 |
+
del async_compile
|
| 179 |
+
|
| 180 |
+
class Runner:
|
| 181 |
+
def __init__(self, partitions):
|
| 182 |
+
self.partitions = partitions
|
| 183 |
+
|
| 184 |
+
def recursively_apply_fns(self, fns):
|
| 185 |
+
new_callables = []
|
| 186 |
+
for fn, c in zip(fns, self.partitions):
|
| 187 |
+
new_callables.append(fn(c))
|
| 188 |
+
self.partitions = new_callables
|
| 189 |
+
|
| 190 |
+
def call(self, args):
|
| 191 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1 = args
|
| 192 |
+
args.clear()
|
| 193 |
+
s90 = arg1_1
|
| 194 |
+
s87 = arg2_1
|
| 195 |
+
s68 = arg3_1
|
| 196 |
+
s53 = arg4_1
|
| 197 |
+
s88 = arg5_1
|
| 198 |
+
assert_size_stride(arg0_1, (1, ), (1, ))
|
| 199 |
+
with torch.cuda._DeviceGuard(4):
|
| 200 |
+
torch.cuda.set_device(4)
|
| 201 |
+
buf0 = empty_strided_cuda((1, ), (1, ), torch.int64)
|
| 202 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, mul, mul_1, valid_offset, sub_3, input_], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.mul, aten.add, aten.sub]
|
| 203 |
+
stream4 = get_raw_stream(4)
|
| 204 |
+
triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0.run(arg0_1, buf0, s90, s87, s68, s53, s88, 1, stream=stream4)
|
| 205 |
+
buf1 = empty_strided_cuda((1, ), (1, ), torch.bool)
|
| 206 |
+
# Topologically Sorted Source Nodes: [ge, lt, org_vocab_mask, ge_1, lt_1, added_vocab_mask, vocab_mask, invert], Original ATen: [aten.ge, aten.lt, aten.bitwise_and, aten.bitwise_or, aten.bitwise_not]
|
| 207 |
+
stream4 = get_raw_stream(4)
|
| 208 |
+
triton_poi_fused_bitwise_and_bitwise_not_bitwise_or_ge_lt_1.run(arg0_1, buf1, s90, s87, s68, s53, 1, stream=stream4)
|
| 209 |
+
del arg0_1
|
| 210 |
+
return (buf0, buf1, )
|
| 211 |
+
|
| 212 |
+
runner = Runner(partitions=[])
|
| 213 |
+
call = runner.call
|
| 214 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def get_args():
|
| 218 |
+
from torch._dynamo.testing import rand_strided
|
| 219 |
+
arg0_1 = rand_strided((1, ), (1, ), device='cuda:4', dtype=torch.int64)
|
| 220 |
+
arg1_1 = 77440
|
| 221 |
+
arg2_1 = 96800
|
| 222 |
+
arg3_1 = 154880
|
| 223 |
+
arg4_1 = 154880
|
| 224 |
+
arg5_1 = 0
|
| 225 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1]
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 229 |
+
from torch._inductor.utils import print_performance
|
| 230 |
+
fn = lambda: call(list(args))
|
| 231 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
if __name__ == "__main__":
|
| 235 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 236 |
+
args = get_args()
|
| 237 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/65/c65lswedy4nxnsl65ku4a6ddu3r55grrzzjaxx6jvoroewo6e2dr.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 16384},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 73728}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x2 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 24 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
.inductor_cache/67/c67bawm35pfjbqa2hnubkrofni4tkbxzyeo5zppu6gsylvqve6eo.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 128},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'out_ptr1': '*i1', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=0, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 2912}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_bitwise_and_bitwise_not_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, out_ptr1, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = ks0
|
| 25 |
+
tmp2 = tmp0 >= tmp1
|
| 26 |
+
tmp3 = ks1
|
| 27 |
+
tmp4 = tmp0 < tmp3
|
| 28 |
+
tmp5 = tmp2 & tmp4
|
| 29 |
+
tmp6 = ks2
|
| 30 |
+
tmp7 = tmp0 >= tmp6
|
| 31 |
+
tmp8 = ks3
|
| 32 |
+
tmp9 = tmp0 < tmp8
|
| 33 |
+
tmp10 = tmp7 & tmp9
|
| 34 |
+
tmp11 = tmp5 | tmp10
|
| 35 |
+
tmp12 = tmp11.to(tl.int64)
|
| 36 |
+
tmp13 = tmp5.to(tl.int64)
|
| 37 |
+
tmp14 = tmp13 * tmp1
|
| 38 |
+
tmp15 = tmp10.to(tl.int64)
|
| 39 |
+
tmp16 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 40 |
+
tmp17 = tmp15 * tmp16
|
| 41 |
+
tmp18 = tmp14 + tmp17
|
| 42 |
+
tmp19 = tmp0 - tmp18
|
| 43 |
+
tmp20 = tmp12 * tmp19
|
| 44 |
+
tmp21 = tmp11 == 0
|
| 45 |
+
tl.store(out_ptr0 + (x0), tmp20, xmask)
|
| 46 |
+
tl.store(out_ptr1 + (x0), tmp21, xmask)
|
.inductor_cache/6d/c6dqripf2w5j4sf6yps4zy7tc4ifqtp2wzcncsdxelw7lhj3o7ou.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 2048},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 28672}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 25 |
+
tmp5 = in_ptr1
|
| 26 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 27 |
+
tmp2 = tmp0 * tmp1
|
| 28 |
+
tmp4 = tmp2 * tmp3
|
| 29 |
+
tmp6 = tmp5.to(tl.float32)
|
| 30 |
+
tmp7 = tmp4 * tmp6
|
| 31 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
.inductor_cache/6d/e62944c5f38dab9ccf24b5504699965ed3bab66acfacc866085a1032c963177d.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 45, "triton_cache_hash": "KGGY5WAIFCN23ENKRQFNT2OZB6CJLZGZIIMD5KHX6XAEJ3DEY7VA"}
|
.inductor_cache/6e/c6emtbesfuldnxatnjaketbq4pjgfhpuh5rpsfrb6iagv4wjnfal.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'ks0': 'i64', 'ks1': 'i64', 'ks2': 'i64', 'ks3': 'i64', 'ks4': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_bitwise_and_bitwise_or_ge_lt_mul_sub_0(in_ptr0, out_ptr0, ks0, ks1, ks2, ks3, ks4, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (0))
|
| 24 |
+
tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
|
| 25 |
+
tmp2 = ks0
|
| 26 |
+
tmp3 = tmp1 >= tmp2
|
| 27 |
+
tmp4 = ks1
|
| 28 |
+
tmp5 = tmp1 < tmp4
|
| 29 |
+
tmp6 = tmp3 & tmp5
|
| 30 |
+
tmp7 = ks2
|
| 31 |
+
tmp8 = tmp1 >= tmp7
|
| 32 |
+
tmp9 = ks3
|
| 33 |
+
tmp10 = tmp1 < tmp9
|
| 34 |
+
tmp11 = tmp8 & tmp10
|
| 35 |
+
tmp12 = tmp6 | tmp11
|
| 36 |
+
tmp13 = tmp12.to(tl.int64)
|
| 37 |
+
tmp14 = tmp6.to(tl.int64)
|
| 38 |
+
tmp15 = tmp14 * tmp2
|
| 39 |
+
tmp16 = tmp11.to(tl.int64)
|
| 40 |
+
tmp17 = ks0 + ks2 + ((-1)*ks1) + ((-1)*ks4)
|
| 41 |
+
tmp18 = tmp16 * tmp17
|
| 42 |
+
tmp19 = tmp15 + tmp18
|
| 43 |
+
tmp20 = tmp1 - tmp19
|
| 44 |
+
tmp21 = tmp13 * tmp20
|
| 45 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32).broadcast_to(XBLOCK)), tmp21, None)
|
.inductor_cache/6j/c6j7f2zfedgsifsvrtdzvprpzw6jujih2uwmzsjrvvfsrmkhcotk.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 2},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
.inductor_cache/6p/28650630bd03810b78b7cf75754dfa35da9d5ed77d198e2f0ce9f078547bb750.best_config
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"XBLOCK": 256, "num_warps": 4, "num_stages": 1, "configs_hash": "1b2cc4dbebb9680d3ce31843331593b159e4046c056f195ca1ccf2464d5b37d1", "found_by_coordesc": false, "time_taken_ms": 43, "triton_cache_hash": "KGGY5WAIFCN23ENKRQFNT2OZB6CJLZGZIIMD5KHX6XAEJ3DEY7VA"}
|
.inductor_cache/6p/c6ppnyt6kjnrqeeq3ra4wx4kwkpeerqiq5ftck3hdmvntgpd6wcs.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 4096},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_out_ptr0': '*fp32', 'in_ptr0': '*fp32', 'in_ptr1': 'fp64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=5, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': ['in_out_ptr0'], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 57344}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_out_ptr0 + (x0), xmask)
|
| 24 |
+
tmp3 = tl.load(in_ptr0 + (x0), xmask)
|
| 25 |
+
tmp5 = in_ptr1
|
| 26 |
+
tmp1 = tl.full([1], 0.1767766952966369, tl.float32)
|
| 27 |
+
tmp2 = tmp0 * tmp1
|
| 28 |
+
tmp4 = tmp2 * tmp3
|
| 29 |
+
tmp6 = tmp5.to(tl.float32)
|
| 30 |
+
tmp7 = tmp4 * tmp6
|
| 31 |
+
tl.store(in_out_ptr0 + (x0), tmp7, xmask)
|
.inductor_cache/6r/c6rthxci3676wj2mwj62e5zmpmln5m2yrpnp2cb63gsxh4u2zxhz.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 2},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=4, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 12}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 25 |
+
tmp2 = tmp0 * tmp1
|
| 26 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 27 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
.inductor_cache/6u/c6uum37r4isrc4g6cyxmskeeex5jl3phh26m7xujcnuux4ijq3jw.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 1},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'constexpr', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=2, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {'xnumel': 1}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xnumel = 1
|
| 20 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 21 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 22 |
+
xmask = tl.full([XBLOCK], True, tl.int1)[:]
|
| 23 |
+
tmp0 = ks0
|
| 24 |
+
tl.store(out_ptr0 + (tl.full([XBLOCK], 0, tl.int32)), tmp0, None)
|
.inductor_cache/6y/c6ygrpcdbuohowjvpdfmrangdf56jqj3p4ig3uwlgavr6t5kkb7a.py
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AOT ID: ['6_inference']
|
| 2 |
+
from ctypes import c_void_p, c_long, c_int
|
| 3 |
+
import torch
|
| 4 |
+
import math
|
| 5 |
+
import random
|
| 6 |
+
import os
|
| 7 |
+
import tempfile
|
| 8 |
+
from math import inf, nan
|
| 9 |
+
from cmath import nanj
|
| 10 |
+
from torch._inductor.hooks import run_intermediate_hooks
|
| 11 |
+
from torch._inductor.utils import maybe_profile
|
| 12 |
+
from torch._inductor.codegen.memory_planning import _align as align
|
| 13 |
+
from torch import device, empty_strided
|
| 14 |
+
from torch._inductor.async_compile import AsyncCompile
|
| 15 |
+
from torch._inductor.select_algorithm import extern_kernels
|
| 16 |
+
import triton
|
| 17 |
+
import triton.language as tl
|
| 18 |
+
from torch._inductor.runtime.triton_heuristics import start_graph, end_graph
|
| 19 |
+
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
|
| 20 |
+
|
| 21 |
+
aten = torch.ops.aten
|
| 22 |
+
inductor_ops = torch.ops.inductor
|
| 23 |
+
_quantized = torch.ops._quantized
|
| 24 |
+
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
|
| 25 |
+
assert_alignment = torch._C._dynamo.guards.assert_alignment
|
| 26 |
+
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
|
| 27 |
+
empty_strided_cpu_pinned = torch._C._dynamo.guards._empty_strided_cpu_pinned
|
| 28 |
+
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
|
| 29 |
+
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
|
| 30 |
+
empty_strided_mtia = torch._C._dynamo.guards._empty_strided_mtia
|
| 31 |
+
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
|
| 32 |
+
alloc_from_pool = torch.ops.inductor._alloc_from_pool
|
| 33 |
+
async_compile = AsyncCompile()
|
| 34 |
+
empty_strided_p2p = torch._C._distributed_c10d._SymmetricMemory.empty_strided_p2p
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/eu/ceujptddvohmrpmi3d35cfzrtagwszsxwklnkpos5z5fi3vn46sj.py
|
| 38 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 39 |
+
# Source node to ATen node mapping:
|
| 40 |
+
# expand_scores => mul_3
|
| 41 |
+
# flatten => view_1
|
| 42 |
+
# max_1 => getitem, max_1
|
| 43 |
+
# unsqueeze => unsqueeze
|
| 44 |
+
# view => view
|
| 45 |
+
# Graph fragment:
|
| 46 |
+
# %arg2_1 : Tensor "f32[s97, 1][1, 1]cuda:3" = PlaceHolder[target=arg2_1]
|
| 47 |
+
# %arg3_1 : Tensor "f32[s97, 1][1, 1]cuda:3" = PlaceHolder[target=arg3_1]
|
| 48 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:3" = PlaceHolder[target=mul_3]
|
| 49 |
+
# %unsqueeze : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%arg2_1, 2), kwargs = {})
|
| 50 |
+
# %view : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%arg3_1, [-1, 1, 1]), kwargs = {})
|
| 51 |
+
# %mul_3 : Tensor "f32[s97, 1, 1][1, 1, 1]cuda:3"[num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%unsqueeze, %view), kwargs = {})
|
| 52 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 53 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 54 |
+
# %getitem : Tensor "f32[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=operator.getitem](args = (%max_1, 0), kwargs = {})
|
| 55 |
+
# return %mul_3,%getitem
|
| 56 |
+
triton_poi_fused_max_mul_unsqueeze_view_0 = async_compile.triton('triton_poi_fused_max_mul_unsqueeze_view_0', '''
|
| 57 |
+
import triton
|
| 58 |
+
import triton.language as tl
|
| 59 |
+
|
| 60 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 61 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 62 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 63 |
+
triton_helpers.set_driver_to_gpu()
|
| 64 |
+
|
| 65 |
+
@triton_heuristics.pointwise(
|
| 66 |
+
size_hints={'x': 8},
|
| 67 |
+
filename=__file__,
|
| 68 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'out_ptr0': '*fp32', 'out_ptr1': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (2,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 69 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_mul_unsqueeze_view_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 2, 'num_store': 2, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 70 |
+
min_elem_per_thread=0
|
| 71 |
+
)
|
| 72 |
+
@triton.jit
|
| 73 |
+
def triton_poi_fused_max_mul_unsqueeze_view_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
|
| 74 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 75 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 76 |
+
xmask = xindex < xnumel
|
| 77 |
+
x0 = xindex
|
| 78 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 79 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 80 |
+
tmp2 = tmp0 * tmp1
|
| 81 |
+
tl.store(out_ptr0 + (x0), tmp2, xmask)
|
| 82 |
+
tl.store(out_ptr1 + (x0), tmp2, xmask)
|
| 83 |
+
''', device_str='cuda')
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/jw/cjwnm4nhtti6dx4kp7rcgvjpxw7ab72wy3zgvwtnnqtlbtlmkzlu.py
|
| 87 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 88 |
+
# Source node to ATen node mapping:
|
| 89 |
+
# flatten => view_1
|
| 90 |
+
# gather => gather
|
| 91 |
+
# max_1 => max_1
|
| 92 |
+
# Graph fragment:
|
| 93 |
+
# %arg4_1 : Tensor "i64[s97, 1][1, 1]cuda:3" = PlaceHolder[target=arg4_1]
|
| 94 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 95 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 96 |
+
# %gather : Tensor "i64[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.gather.default](args = (%arg4_1, 1, %getitem_1), kwargs = {})
|
| 97 |
+
# return %gather
|
| 98 |
+
triton_poi_fused_gather_max_view_1 = async_compile.triton('triton_poi_fused_gather_max_view_1', '''
|
| 99 |
+
import triton
|
| 100 |
+
import triton.language as tl
|
| 101 |
+
|
| 102 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 103 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 104 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 105 |
+
triton_helpers.set_driver_to_gpu()
|
| 106 |
+
|
| 107 |
+
@triton_heuristics.pointwise(
|
| 108 |
+
size_hints={'x': 8},
|
| 109 |
+
filename=__file__,
|
| 110 |
+
triton_meta={'signature': {'in_ptr0': '*i64', 'out_ptr0': '*i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 111 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_gather_max_view_1', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 192}},
|
| 112 |
+
min_elem_per_thread=0
|
| 113 |
+
)
|
| 114 |
+
@triton.jit
|
| 115 |
+
def triton_poi_fused_gather_max_view_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 116 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 117 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 118 |
+
xmask = xindex < xnumel
|
| 119 |
+
x0 = xindex
|
| 120 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 121 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 122 |
+
''', device_str='cuda')
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/o6/co6hyomcl3npwceolu64q5bdvrb7h6qa4h3fycnlkntxzzmdzmue.py
|
| 126 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 127 |
+
# Source node to ATen node mapping:
|
| 128 |
+
# batch_offsets => iota
|
| 129 |
+
# flat_cs => view_4
|
| 130 |
+
# flatten => view_1
|
| 131 |
+
# floordiv => div
|
| 132 |
+
# hidden_states => index
|
| 133 |
+
# max_1 => max_1
|
| 134 |
+
# repeat_interleave => unsqueeze_1, view_5
|
| 135 |
+
# selected_input_index => add_47
|
| 136 |
+
# Graph fragment:
|
| 137 |
+
# %arg6_1 : Tensor "bf16[s97, s87][s87, 1]cuda:3" = PlaceHolder[target=arg6_1]
|
| 138 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 139 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 140 |
+
# %view_4 : Tensor "i64[s97][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%getitem_1, [%arg1_1]), kwargs = {})
|
| 141 |
+
# %div : Tensor "i64[s97][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.div.Tensor_mode](args = (%view_4, 1), kwargs = {rounding_mode: floor})
|
| 142 |
+
# %iota : Tensor "i64[s97][1]cuda:3"[num_users=1] = call_function[target=torch.ops.prims.iota.default](args = (%arg1_1,), kwargs = {start: 0, step: 1, dtype: torch.int64, device: cuda:3, requires_grad: False})
|
| 143 |
+
# %unsqueeze_1 : Tensor "i64[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.unsqueeze.default](args = (%iota, 1), kwargs = {})
|
| 144 |
+
# %view_5 : Tensor "i64[s97][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%expand, [%arg1_1]), kwargs = {})
|
| 145 |
+
# %add_47 : Tensor "i64[s97][1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %view_5), kwargs = {})
|
| 146 |
+
# %index : Tensor "bf16[s97, s87][s87, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.index.Tensor](args = (%arg6_1, [%add_47]), kwargs = {})
|
| 147 |
+
# return %index
|
| 148 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2 = async_compile.triton('triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', '''
|
| 149 |
+
import triton
|
| 150 |
+
import triton.language as tl
|
| 151 |
+
|
| 152 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 153 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 154 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 155 |
+
triton_helpers.set_driver_to_gpu()
|
| 156 |
+
|
| 157 |
+
@triton_heuristics.pointwise(
|
| 158 |
+
size_hints={'x': 65536},
|
| 159 |
+
filename=__file__,
|
| 160 |
+
triton_meta={'signature': {'in_ptr0': '*bf16', 'out_ptr0': '*bf16', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]]}]},
|
| 161 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 1, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 294912}},
|
| 162 |
+
min_elem_per_thread=0
|
| 163 |
+
)
|
| 164 |
+
@triton.jit
|
| 165 |
+
def triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 166 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 167 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 168 |
+
xmask = xindex < xnumel
|
| 169 |
+
x2 = xindex
|
| 170 |
+
tmp0 = tl.load(in_ptr0 + (x2), xmask, eviction_policy='evict_last').to(tl.float32)
|
| 171 |
+
tl.store(out_ptr0 + (x2), tmp0, xmask)
|
| 172 |
+
''', device_str='cuda')
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
# kernel path: /mnt/glm5_2/.inductor_cache/dm/cdmvkduxzdqrvvphvyrynpwm77ulv5m44qrmm2izq36cx2yge35l.py
|
| 176 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 177 |
+
# Source node to ATen node mapping:
|
| 178 |
+
# add_2 => add_53
|
| 179 |
+
# flatten => view_1
|
| 180 |
+
# max_1 => max_1
|
| 181 |
+
# Graph fragment:
|
| 182 |
+
# %view_1 : Tensor "f32[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.reshape.default](args = (%mul_3, [%arg1_1, 1]), kwargs = {})
|
| 183 |
+
# %max_1 : [num_users=2] = call_function[target=torch.ops.aten.max.dim](args = (%view_1, -1, True), kwargs = {})
|
| 184 |
+
# %add_53 : Tensor "i64[s97, 1][1, 1]cuda:3"[num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%getitem_1, %arg7_1), kwargs = {})
|
| 185 |
+
# return %add_53
|
| 186 |
+
triton_poi_fused_add_max_view_3 = async_compile.triton('triton_poi_fused_add_max_view_3', '''
|
| 187 |
+
import triton
|
| 188 |
+
import triton.language as tl
|
| 189 |
+
|
| 190 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 191 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 192 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 193 |
+
triton_helpers.set_driver_to_gpu()
|
| 194 |
+
|
| 195 |
+
@triton_heuristics.pointwise(
|
| 196 |
+
size_hints={'x': 8},
|
| 197 |
+
filename=__file__,
|
| 198 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=3, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 199 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 128}},
|
| 200 |
+
min_elem_per_thread=0
|
| 201 |
+
)
|
| 202 |
+
@triton.jit
|
| 203 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 204 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 205 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 206 |
+
xmask = xindex < xnumel
|
| 207 |
+
x0 = xindex
|
| 208 |
+
tmp0 = ks0
|
| 209 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|
| 210 |
+
''', device_str='cuda')
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
async_compile.wait(globals())
|
| 214 |
+
del async_compile
|
| 215 |
+
|
| 216 |
+
class Runner:
|
| 217 |
+
def __init__(self, partitions):
|
| 218 |
+
self.partitions = partitions
|
| 219 |
+
|
| 220 |
+
def recursively_apply_fns(self, fns):
|
| 221 |
+
new_callables = []
|
| 222 |
+
for fn, c in zip(fns, self.partitions):
|
| 223 |
+
new_callables.append(fn(c))
|
| 224 |
+
self.partitions = new_callables
|
| 225 |
+
|
| 226 |
+
def call(self, args):
|
| 227 |
+
arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1 = args
|
| 228 |
+
args.clear()
|
| 229 |
+
s53 = arg0_1
|
| 230 |
+
s97 = arg1_1
|
| 231 |
+
s87 = arg5_1
|
| 232 |
+
s77 = arg7_1
|
| 233 |
+
assert_size_stride(arg2_1, (s97, 1), (1, 1))
|
| 234 |
+
assert_size_stride(arg3_1, (s97, 1), (1, 1))
|
| 235 |
+
assert_size_stride(arg4_1, (s97, 1), (1, 1))
|
| 236 |
+
assert_size_stride(arg6_1, (s97, s87), (s87, 1))
|
| 237 |
+
with torch.cuda._DeviceGuard(3):
|
| 238 |
+
torch.cuda.set_device(3)
|
| 239 |
+
buf0 = empty_strided_cuda((s97, 1, 1), (1, 1, 1), torch.float32)
|
| 240 |
+
buf1 = empty_strided_cuda((s97, 1), (1, 1), torch.float32)
|
| 241 |
+
# Topologically Sorted Source Nodes: [unsqueeze, view, expand_scores, flatten, max_1], Original ATen: [aten.unsqueeze, aten.view, aten.mul, aten.max]
|
| 242 |
+
stream3 = get_raw_stream(3)
|
| 243 |
+
triton_poi_fused_max_mul_unsqueeze_view_0.run(arg2_1, arg3_1, buf0, buf1, s97, stream=stream3)
|
| 244 |
+
del arg2_1
|
| 245 |
+
del arg3_1
|
| 246 |
+
buf2 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 247 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, gather], Original ATen: [aten.view, aten.max, aten.gather]
|
| 248 |
+
stream3 = get_raw_stream(3)
|
| 249 |
+
triton_poi_fused_gather_max_view_1.run(arg4_1, buf2, s97, stream=stream3)
|
| 250 |
+
buf3 = empty_strided_cuda((s97, s87), (s87, 1), torch.bfloat16)
|
| 251 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, flat_cs, floordiv, batch_offsets, repeat_interleave, selected_input_index, hidden_states], Original ATen: [aten.view, aten.max, aten.floor_divide, aten.arange, aten.unsqueeze, aten.add, aten.index]
|
| 252 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel = s87*s97
|
| 253 |
+
stream3 = get_raw_stream(3)
|
| 254 |
+
triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2.run(arg6_1, buf3, triton_poi_fused_add_arange_floor_divide_index_max_unsqueeze_view_2_xnumel, stream=stream3)
|
| 255 |
+
del arg6_1
|
| 256 |
+
buf4 = empty_strided_cuda((s97, 1), (1, 1), torch.int64)
|
| 257 |
+
# Topologically Sorted Source Nodes: [flatten, max_1, add_2], Original ATen: [aten.view, aten.max, aten.add]
|
| 258 |
+
stream3 = get_raw_stream(3)
|
| 259 |
+
triton_poi_fused_add_max_view_3.run(buf4, s77, s97, stream=stream3)
|
| 260 |
+
return (reinterpret_tensor(buf2, (s97, ), (1, ), 0), buf3, buf1, buf0, arg4_1, buf4, )
|
| 261 |
+
|
| 262 |
+
runner = Runner(partitions=[])
|
| 263 |
+
call = runner.call
|
| 264 |
+
recursively_apply_fns = runner.recursively_apply_fns
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def get_args():
|
| 268 |
+
from torch._dynamo.testing import rand_strided
|
| 269 |
+
arg0_1 = 1
|
| 270 |
+
arg1_1 = 8
|
| 271 |
+
arg2_1 = rand_strided((8, 1), (1, 1), device='cuda:3', dtype=torch.float32)
|
| 272 |
+
arg3_1 = rand_strided((8, 1), (1, 1), device='cuda:3', dtype=torch.float32)
|
| 273 |
+
arg4_1 = rand_strided((8, 1), (1, 1), device='cuda:3', dtype=torch.int64)
|
| 274 |
+
arg5_1 = 6144
|
| 275 |
+
arg6_1 = rand_strided((8, 6144), (6144, 1), device='cuda:3', dtype=torch.bfloat16)
|
| 276 |
+
arg7_1 = 1
|
| 277 |
+
return [arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, arg5_1, arg6_1, arg7_1]
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
def benchmark_compiled_module(args, times=10, repeat=10):
|
| 281 |
+
from torch._inductor.utils import print_performance
|
| 282 |
+
fn = lambda: call(list(args))
|
| 283 |
+
return print_performance(fn, times=times, repeat=repeat)
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
if __name__ == "__main__":
|
| 287 |
+
from torch._inductor.wrapper_benchmark import compiled_module_main
|
| 288 |
+
args = get_args()
|
| 289 |
+
compiled_module_main('None', lambda times, repeat: benchmark_compiled_module(args, times=times, repeat=repeat))
|
.inductor_cache/6z/c6zyuqh3bo3nxnmo267egfmzuh75yqhd4pdyfrvq5jc5nfexlxsk.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 32},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'in_ptr0': '*fp32', 'in_ptr1': '*fp32', 'in_ptr2': 'fp64', 'out_ptr0': '*fp32', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=1, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]], (1,): [['tt.divisibility', 16]], (3,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_unsqueeze_0', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 3, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 512}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_mul_unsqueeze_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = tl.load(in_ptr0 + (x0), xmask)
|
| 24 |
+
tmp1 = tl.load(in_ptr1 + (x0), xmask)
|
| 25 |
+
tmp3 = in_ptr2
|
| 26 |
+
tmp2 = tmp0 * tmp1
|
| 27 |
+
tmp4 = tmp3.to(tl.float32)
|
| 28 |
+
tmp5 = tmp2 * tmp4
|
| 29 |
+
tl.store(out_ptr0 + (x0), tmp5, xmask)
|
.inductor_cache/76/c76y7ge3o24p7dwc6aulba5id74axw62oevitux7yjjlbrbsx66u.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import triton
|
| 3 |
+
import triton.language as tl
|
| 4 |
+
|
| 5 |
+
from torch._inductor.runtime import triton_helpers, triton_heuristics
|
| 6 |
+
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
|
| 7 |
+
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, DeviceProperties
|
| 8 |
+
triton_helpers.set_driver_to_gpu()
|
| 9 |
+
|
| 10 |
+
@triton_heuristics.pointwise(
|
| 11 |
+
size_hints={'x': 8},
|
| 12 |
+
filename=__file__,
|
| 13 |
+
triton_meta={'signature': {'out_ptr0': '*i64', 'ks0': 'i64', 'xnumel': 'i32', 'XBLOCK': 'constexpr'}, 'device': DeviceProperties(type='cuda', index=7, multi_processor_count=148, cc=100, major=10, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, max_threads_per_block=1024, warp_size=32), 'constants': {}, 'native_matmul': False, 'enable_fp_fusion': True, 'launch_pdl': False, 'disable_ftz': False, 'configs': [{(0,): [['tt.divisibility', 16]]}]},
|
| 14 |
+
inductor_meta={'grid_type': 'Grid1D', 'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_max_view_3', 'mutated_arg_names': [], 'optimize_mem': True, 'no_x_dim': False, 'atomic_add_found': False, 'num_load': 0, 'num_store': 1, 'num_reduction': 0, 'backend_hash': 'B9347ED8E82563C0DF6E4C45E8A40BBC93F818749C1452A3CD0A7365095FE2BD', 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False, 'deterministic': False, 'force_filter_reduction_configs': False, 'mix_order_reduction_allow_multi_stages': False, 'are_deterministic_algorithms_enabled': False, 'tiling_scores': {'x': 128}},
|
| 15 |
+
min_elem_per_thread=0
|
| 16 |
+
)
|
| 17 |
+
@triton.jit
|
| 18 |
+
def triton_poi_fused_add_max_view_3(out_ptr0, ks0, xnumel, XBLOCK : tl.constexpr):
|
| 19 |
+
xoffset = tl.program_id(0) * XBLOCK
|
| 20 |
+
xindex = xoffset + tl.arange(0, XBLOCK)[:]
|
| 21 |
+
xmask = xindex < xnumel
|
| 22 |
+
x0 = xindex
|
| 23 |
+
tmp0 = ks0
|
| 24 |
+
tl.store(out_ptr0 + (x0), tmp0, xmask)
|