[CCCL] 瘦身 + 补全: 移除 cudax/python/libcudacxx-tests 冗余文件, 新增 c2h 测试助手 + cmake 构建系统 + 8 个 CUDA thrust examples

变更摘要:
- 删除: cudax/ (783 files, 7.2M) — 实验性组件,竞赛不需要
- 删除: python/ (226 files, 2.0M) — Python 绑定,竞赛不需要
- 删除: libcudacxx/{test,benchmarks,codegen,cmake,share} (4432 files, 31M)
  保留: libcudacxx/include/ (1463 headers, cuda::std 编译依赖)
- 新增: c2h/ (27 files) — CUB Catch2 测试辅助头文件,编译 243 个测试必需
- 新增: cmake/ (29 files) — CCCL 原生 CMake 构建系统
- 新增: thrust/examples/cuda/ (7 files) + cpp_integration/ (1 file)
  async_reduce, custom_temporary_allocation, explicit_cuda_stream,
  global_device_vector, range_view, unwrap_pointer, wrap_pointer, device

结果: cccl_upstream 从 74M→35M (瘦身 53%), 核心内容 100% 保留:
  27/27 tuning headers, 78 benchmarks, 243 tests,
  60 thrust examples, 18 CUB examples, 全部编译头文件
This commit is contained in:
muh-bot
2026-08-03 12:39:26 +00:00
parent a2a5dd8f00
commit 24ef6a91b5
5439 changed files with 0 additions and 719516 deletions

View File

@@ -1,355 +0,0 @@
package my_package
fn conditional_swap(x: bits[16], y: bits[16], tmp: bits[16]) -> bits[16] {
bit_slice.936: bits[1] = bit_slice(y, start=15, width=1, id=936)
bit_slice.935: bits[1] = bit_slice(y, start=14, width=1, id=935)
bit_slice.952: bits[1] = bit_slice(x, start=15, width=1, id=952)
not.953: bits[1] = not(bit_slice.936, id=953)
bit_slice.951: bits[1] = bit_slice(x, start=14, width=1, id=951)
not.954: bits[1] = not(bit_slice.935, id=954)
bit_slice.934: bits[1] = bit_slice(y, start=13, width=1, id=934)
and.968: bits[1] = and(bit_slice.952, not.953, id=968)
and.971: bits[1] = and(bit_slice.951, not.954, id=971)
bit_slice.950: bits[1] = bit_slice(x, start=13, width=1, id=950)
not.955: bits[1] = not(bit_slice.934, id=955)
bit_slice.933: bits[1] = bit_slice(y, start=12, width=1, id=933)
not.969: bits[1] = not(and.968, id=969)
not.970: bits[1] = not(bit_slice.951, id=970)
not.972: bits[1] = not(and.971, id=972)
and.974: bits[1] = and(bit_slice.950, not.955, id=974)
bit_slice.949: bits[1] = bit_slice(x, start=12, width=1, id=949)
not.956: bits[1] = not(bit_slice.933, id=956)
bit_slice.932: bits[1] = bit_slice(y, start=11, width=1, id=932)
or.1014: bits[1] = or(bit_slice.952, not.953, id=1014)
and.1016: bits[1] = and(not.969, not.970, id=1016)
and.1018: bits[1] = and(not.969, not.972, id=1018)
not.973: bits[1] = not(bit_slice.950, id=973)
and.1021: bits[1] = and(not.969, not.972, id=1021)
not.975: bits[1] = not(and.974, id=975)
and.1025: bits[1] = and(not.969, not.972, id=1025)
and.977: bits[1] = and(bit_slice.949, not.956, id=977)
and.1030: bits[1] = and(not.969, not.972, id=1030)
bit_slice.948: bits[1] = bit_slice(x, start=11, width=1, id=948)
not.957: bits[1] = not(bit_slice.932, id=957)
and.1036: bits[1] = and(not.969, not.972, id=1036)
bit_slice.931: bits[1] = bit_slice(y, start=10, width=1, id=931)
and.1043: bits[1] = and(not.969, not.972, id=1043)
and.1051: bits[1] = and(not.969, not.972, id=1051)
and.1060: bits[1] = and(not.969, not.972, id=1060)
and.1070: bits[1] = and(not.969, not.972, id=1070)
and.1081: bits[1] = and(not.969, not.972, id=1081)
and.1093: bits[1] = and(not.969, not.972, id=1093)
and.1106: bits[1] = and(not.969, not.972, id=1106)
and.1120: bits[1] = and(not.969, not.972, id=1120)
and.1135: bits[1] = and(not.969, not.972, id=1135)
not.1015: bits[1] = not(or.1014, id=1015)
and.1017: bits[1] = and(and.1016, bit_slice.935, id=1017)
and.1019: bits[1] = and(and.1018, not.973, id=1019)
and.1022: bits[1] = and(and.1021, not.975, id=1022)
not.976: bits[1] = not(bit_slice.949, id=976)
and.1026: bits[1] = and(and.1025, not.975, id=1026)
not.978: bits[1] = not(and.977, id=978)
and.1031: bits[1] = and(and.1030, not.975, id=1031)
and.980: bits[1] = and(bit_slice.948, not.957, id=980)
and.1037: bits[1] = and(and.1036, not.975, id=1037)
bit_slice.947: bits[1] = bit_slice(x, start=10, width=1, id=947)
not.958: bits[1] = not(bit_slice.931, id=958)
and.1044: bits[1] = and(and.1043, not.975, id=1044)
bit_slice.930: bits[1] = bit_slice(y, start=9, width=1, id=930)
and.1052: bits[1] = and(and.1051, not.975, id=1052)
and.1061: bits[1] = and(and.1060, not.975, id=1061)
and.1071: bits[1] = and(and.1070, not.975, id=1071)
and.1082: bits[1] = and(and.1081, not.975, id=1082)
and.1094: bits[1] = and(and.1093, not.975, id=1094)
and.1107: bits[1] = and(and.1106, not.975, id=1107)
and.1121: bits[1] = and(and.1120, not.975, id=1121)
and.1136: bits[1] = and(and.1135, not.975, id=1136)
or.1153: bits[1] = or(not.1015, and.1017, id=1153)
and.1020: bits[1] = and(and.1019, bit_slice.934, id=1020)
and.1023: bits[1] = and(and.1022, not.976, id=1023)
and.1027: bits[1] = and(and.1026, not.978, id=1027)
not.979: bits[1] = not(bit_slice.948, id=979)
and.1032: bits[1] = and(and.1031, not.978, id=1032)
not.981: bits[1] = not(and.980, id=981)
and.1038: bits[1] = and(and.1037, not.978, id=1038)
and.983: bits[1] = and(bit_slice.947, not.958, id=983)
and.1045: bits[1] = and(and.1044, not.978, id=1045)
bit_slice.946: bits[1] = bit_slice(x, start=9, width=1, id=946)
not.959: bits[1] = not(bit_slice.930, id=959)
and.1053: bits[1] = and(and.1052, not.978, id=1053)
bit_slice.929: bits[1] = bit_slice(y, start=8, width=1, id=929)
and.1062: bits[1] = and(and.1061, not.978, id=1062)
and.1072: bits[1] = and(and.1071, not.978, id=1072)
and.1083: bits[1] = and(and.1082, not.978, id=1083)
and.1095: bits[1] = and(and.1094, not.978, id=1095)
and.1108: bits[1] = and(and.1107, not.978, id=1108)
and.1122: bits[1] = and(and.1121, not.978, id=1122)
and.1137: bits[1] = and(and.1136, not.978, id=1137)
or.1154: bits[1] = or(or.1153, and.1020, id=1154)
and.1024: bits[1] = and(and.1023, bit_slice.933, id=1024)
and.1028: bits[1] = and(and.1027, not.979, id=1028)
and.1033: bits[1] = and(and.1032, not.981, id=1033)
not.982: bits[1] = not(bit_slice.947, id=982)
and.1039: bits[1] = and(and.1038, not.981, id=1039)
not.984: bits[1] = not(and.983, id=984)
and.1046: bits[1] = and(and.1045, not.981, id=1046)
and.986: bits[1] = and(bit_slice.946, not.959, id=986)
and.1054: bits[1] = and(and.1053, not.981, id=1054)
bit_slice.945: bits[1] = bit_slice(x, start=8, width=1, id=945)
not.960: bits[1] = not(bit_slice.929, id=960)
and.1063: bits[1] = and(and.1062, not.981, id=1063)
bit_slice.928: bits[1] = bit_slice(y, start=7, width=1, id=928)
and.1073: bits[1] = and(and.1072, not.981, id=1073)
and.1084: bits[1] = and(and.1083, not.981, id=1084)
and.1096: bits[1] = and(and.1095, not.981, id=1096)
and.1109: bits[1] = and(and.1108, not.981, id=1109)
and.1123: bits[1] = and(and.1122, not.981, id=1123)
and.1138: bits[1] = and(and.1137, not.981, id=1138)
or.1155: bits[1] = or(or.1154, and.1024, id=1155)
and.1029: bits[1] = and(and.1028, bit_slice.932, id=1029)
and.1034: bits[1] = and(and.1033, not.982, id=1034)
and.1040: bits[1] = and(and.1039, not.984, id=1040)
not.985: bits[1] = not(bit_slice.946, id=985)
and.1047: bits[1] = and(and.1046, not.984, id=1047)
not.987: bits[1] = not(and.986, id=987)
and.1055: bits[1] = and(and.1054, not.984, id=1055)
and.989: bits[1] = and(bit_slice.945, not.960, id=989)
and.1064: bits[1] = and(and.1063, not.984, id=1064)
bit_slice.944: bits[1] = bit_slice(x, start=7, width=1, id=944)
not.961: bits[1] = not(bit_slice.928, id=961)
and.1074: bits[1] = and(and.1073, not.984, id=1074)
bit_slice.927: bits[1] = bit_slice(y, start=6, width=1, id=927)
and.1085: bits[1] = and(and.1084, not.984, id=1085)
and.1097: bits[1] = and(and.1096, not.984, id=1097)
and.1110: bits[1] = and(and.1109, not.984, id=1110)
and.1124: bits[1] = and(and.1123, not.984, id=1124)
and.1139: bits[1] = and(and.1138, not.984, id=1139)
or.1156: bits[1] = or(or.1155, and.1029, id=1156)
and.1035: bits[1] = and(and.1034, bit_slice.931, id=1035)
and.1041: bits[1] = and(and.1040, not.985, id=1041)
and.1048: bits[1] = and(and.1047, not.987, id=1048)
not.988: bits[1] = not(bit_slice.945, id=988)
and.1056: bits[1] = and(and.1055, not.987, id=1056)
not.990: bits[1] = not(and.989, id=990)
and.1065: bits[1] = and(and.1064, not.987, id=1065)
and.992: bits[1] = and(bit_slice.944, not.961, id=992)
and.1075: bits[1] = and(and.1074, not.987, id=1075)
bit_slice.943: bits[1] = bit_slice(x, start=6, width=1, id=943)
not.962: bits[1] = not(bit_slice.927, id=962)
and.1086: bits[1] = and(and.1085, not.987, id=1086)
bit_slice.926: bits[1] = bit_slice(y, start=5, width=1, id=926)
and.1098: bits[1] = and(and.1097, not.987, id=1098)
and.1111: bits[1] = and(and.1110, not.987, id=1111)
and.1125: bits[1] = and(and.1124, not.987, id=1125)
and.1140: bits[1] = and(and.1139, not.987, id=1140)
or.1157: bits[1] = or(or.1156, and.1035, id=1157)
and.1042: bits[1] = and(and.1041, bit_slice.930, id=1042)
and.1049: bits[1] = and(and.1048, not.988, id=1049)
and.1057: bits[1] = and(and.1056, not.990, id=1057)
not.991: bits[1] = not(bit_slice.944, id=991)
and.1066: bits[1] = and(and.1065, not.990, id=1066)
not.993: bits[1] = not(and.992, id=993)
and.1076: bits[1] = and(and.1075, not.990, id=1076)
and.995: bits[1] = and(bit_slice.943, not.962, id=995)
and.1087: bits[1] = and(and.1086, not.990, id=1087)
bit_slice.942: bits[1] = bit_slice(x, start=5, width=1, id=942)
not.963: bits[1] = not(bit_slice.926, id=963)
and.1099: bits[1] = and(and.1098, not.990, id=1099)
bit_slice.925: bits[1] = bit_slice(y, start=4, width=1, id=925)
and.1112: bits[1] = and(and.1111, not.990, id=1112)
and.1126: bits[1] = and(and.1125, not.990, id=1126)
and.1141: bits[1] = and(and.1140, not.990, id=1141)
or.1158: bits[1] = or(or.1157, and.1042, id=1158)
and.1050: bits[1] = and(and.1049, bit_slice.929, id=1050)
and.1058: bits[1] = and(and.1057, not.991, id=1058)
and.1067: bits[1] = and(and.1066, not.993, id=1067)
not.994: bits[1] = not(bit_slice.943, id=994)
and.1077: bits[1] = and(and.1076, not.993, id=1077)
not.996: bits[1] = not(and.995, id=996)
and.1088: bits[1] = and(and.1087, not.993, id=1088)
and.998: bits[1] = and(bit_slice.942, not.963, id=998)
and.1100: bits[1] = and(and.1099, not.993, id=1100)
bit_slice.941: bits[1] = bit_slice(x, start=4, width=1, id=941)
not.964: bits[1] = not(bit_slice.925, id=964)
and.1113: bits[1] = and(and.1112, not.993, id=1113)
bit_slice.924: bits[1] = bit_slice(y, start=3, width=1, id=924)
and.1127: bits[1] = and(and.1126, not.993, id=1127)
and.1142: bits[1] = and(and.1141, not.993, id=1142)
or.1159: bits[1] = or(or.1158, and.1050, id=1159)
and.1059: bits[1] = and(and.1058, bit_slice.928, id=1059)
and.1068: bits[1] = and(and.1067, not.994, id=1068)
and.1078: bits[1] = and(and.1077, not.996, id=1078)
not.997: bits[1] = not(bit_slice.942, id=997)
and.1089: bits[1] = and(and.1088, not.996, id=1089)
not.999: bits[1] = not(and.998, id=999)
and.1101: bits[1] = and(and.1100, not.996, id=1101)
and.1001: bits[1] = and(bit_slice.941, not.964, id=1001)
and.1114: bits[1] = and(and.1113, not.996, id=1114)
bit_slice.940: bits[1] = bit_slice(x, start=3, width=1, id=940)
not.965: bits[1] = not(bit_slice.924, id=965)
and.1128: bits[1] = and(and.1127, not.996, id=1128)
bit_slice.923: bits[1] = bit_slice(y, start=2, width=1, id=923)
and.1143: bits[1] = and(and.1142, not.996, id=1143)
or.1160: bits[1] = or(or.1159, and.1059, id=1160)
and.1069: bits[1] = and(and.1068, bit_slice.927, id=1069)
and.1079: bits[1] = and(and.1078, not.997, id=1079)
and.1090: bits[1] = and(and.1089, not.999, id=1090)
not.1000: bits[1] = not(bit_slice.941, id=1000)
and.1102: bits[1] = and(and.1101, not.999, id=1102)
not.1002: bits[1] = not(and.1001, id=1002)
and.1115: bits[1] = and(and.1114, not.999, id=1115)
and.1004: bits[1] = and(bit_slice.940, not.965, id=1004)
and.1129: bits[1] = and(and.1128, not.999, id=1129)
bit_slice.939: bits[1] = bit_slice(x, start=2, width=1, id=939)
not.966: bits[1] = not(bit_slice.923, id=966)
and.1144: bits[1] = and(and.1143, not.999, id=1144)
bit_slice.922: bits[1] = bit_slice(y, start=1, width=1, id=922)
or.1161: bits[1] = or(or.1160, and.1069, id=1161)
and.1080: bits[1] = and(and.1079, bit_slice.926, id=1080)
and.1091: bits[1] = and(and.1090, not.1000, id=1091)
and.1103: bits[1] = and(and.1102, not.1002, id=1103)
not.1003: bits[1] = not(bit_slice.940, id=1003)
and.1116: bits[1] = and(and.1115, not.1002, id=1116)
not.1005: bits[1] = not(and.1004, id=1005)
and.1130: bits[1] = and(and.1129, not.1002, id=1130)
and.1007: bits[1] = and(bit_slice.939, not.966, id=1007)
and.1145: bits[1] = and(and.1144, not.1002, id=1145)
bit_slice.938: bits[1] = bit_slice(x, start=1, width=1, id=938)
not.967: bits[1] = not(bit_slice.922, id=967)
or.1162: bits[1] = or(or.1161, and.1080, id=1162)
and.1092: bits[1] = and(and.1091, bit_slice.925, id=1092)
and.1104: bits[1] = and(and.1103, not.1003, id=1104)
and.1117: bits[1] = and(and.1116, not.1005, id=1117)
not.1006: bits[1] = not(bit_slice.939, id=1006)
and.1131: bits[1] = and(and.1130, not.1005, id=1131)
not.1008: bits[1] = not(and.1007, id=1008)
and.1146: bits[1] = and(and.1145, not.1005, id=1146)
and.1010: bits[1] = and(bit_slice.938, not.967, id=1010)
or.1163: bits[1] = or(or.1162, and.1092, id=1163)
and.1105: bits[1] = and(and.1104, bit_slice.924, id=1105)
and.1118: bits[1] = and(and.1117, not.1006, id=1118)
and.1132: bits[1] = and(and.1131, not.1008, id=1132)
not.1009: bits[1] = not(bit_slice.938, id=1009)
and.1147: bits[1] = and(and.1146, not.1008, id=1147)
not.1011: bits[1] = not(and.1010, id=1011)
bit_slice.937: bits[1] = bit_slice(x, start=0, width=1, id=937)
or.1164: bits[1] = or(or.1163, and.1105, id=1164)
and.1119: bits[1] = and(and.1118, bit_slice.923, id=1119)
and.1133: bits[1] = and(and.1132, not.1009, id=1133)
and.1148: bits[1] = and(and.1147, not.1011, id=1148)
not.1012: bits[1] = not(bit_slice.937, id=1012)
not.1013: bits[1] = not(bit_slice.952, id=1013)
or.1165: bits[1] = or(or.1164, and.1119, id=1165)
and.1134: bits[1] = and(and.1133, bit_slice.922, id=1134)
and.1149: bits[1] = and(and.1148, not.1012, id=1149)
bit_slice.921: bits[1] = bit_slice(y, start=0, width=1, id=921)
and.1151: bits[1] = and(not.1013, bit_slice.936, id=1151)
or.1166: bits[1] = or(or.1165, and.1134, id=1166)
and.1150: bits[1] = and(and.1149, bit_slice.921, id=1150)
or.1168: bits[1] = or(not.1013, bit_slice.936, id=1168)
not.1152: bits[1] = not(and.1151, id=1152)
or.1167: bits[1] = or(or.1166, and.1150, id=1167)
not.1169: bits[1] = not(or.1168, id=1169)
and.1170: bits[1] = and(not.1152, or.1167, id=1170)
bit_slice.1186: bits[1] = bit_slice(tmp, start=15, width=1, id=1186)
or.1187: bits[1] = or(not.1169, and.1170, id=1187)
bit_slice.1185: bits[1] = bit_slice(tmp, start=14, width=1, id=1185)
bit_slice.1184: bits[1] = bit_slice(tmp, start=13, width=1, id=1184)
bit_slice.1183: bits[1] = bit_slice(tmp, start=12, width=1, id=1183)
bit_slice.1182: bits[1] = bit_slice(tmp, start=11, width=1, id=1182)
bit_slice.1181: bits[1] = bit_slice(tmp, start=10, width=1, id=1181)
bit_slice.1180: bits[1] = bit_slice(tmp, start=9, width=1, id=1180)
bit_slice.1179: bits[1] = bit_slice(tmp, start=8, width=1, id=1179)
bit_slice.1178: bits[1] = bit_slice(tmp, start=7, width=1, id=1178)
bit_slice.1177: bits[1] = bit_slice(tmp, start=6, width=1, id=1177)
bit_slice.1176: bits[1] = bit_slice(tmp, start=5, width=1, id=1176)
bit_slice.1175: bits[1] = bit_slice(tmp, start=4, width=1, id=1175)
bit_slice.1174: bits[1] = bit_slice(tmp, start=3, width=1, id=1174)
bit_slice.1173: bits[1] = bit_slice(tmp, start=2, width=1, id=1173)
bit_slice.1172: bits[1] = bit_slice(tmp, start=1, width=1, id=1172)
bit_slice.1171: bits[1] = bit_slice(tmp, start=0, width=1, id=1171)
and.1189: bits[1] = and(bit_slice.952, bit_slice.1186, id=1189)
and.1190: bits[1] = and(bit_slice.952, or.1187, id=1190)
not.1188: bits[1] = not(or.1187, id=1188)
and.1192: bits[1] = and(bit_slice.951, bit_slice.1185, id=1192)
and.1193: bits[1] = and(bit_slice.951, or.1187, id=1193)
and.1195: bits[1] = and(bit_slice.950, bit_slice.1184, id=1195)
and.1196: bits[1] = and(bit_slice.950, or.1187, id=1196)
and.1198: bits[1] = and(bit_slice.949, bit_slice.1183, id=1198)
and.1199: bits[1] = and(bit_slice.949, or.1187, id=1199)
and.1201: bits[1] = and(bit_slice.948, bit_slice.1182, id=1201)
and.1202: bits[1] = and(bit_slice.948, or.1187, id=1202)
and.1204: bits[1] = and(bit_slice.947, bit_slice.1181, id=1204)
and.1205: bits[1] = and(bit_slice.947, or.1187, id=1205)
and.1207: bits[1] = and(bit_slice.946, bit_slice.1180, id=1207)
and.1208: bits[1] = and(bit_slice.946, or.1187, id=1208)
and.1210: bits[1] = and(bit_slice.945, bit_slice.1179, id=1210)
and.1211: bits[1] = and(bit_slice.945, or.1187, id=1211)
and.1213: bits[1] = and(bit_slice.944, bit_slice.1178, id=1213)
and.1214: bits[1] = and(bit_slice.944, or.1187, id=1214)
and.1216: bits[1] = and(bit_slice.943, bit_slice.1177, id=1216)
and.1217: bits[1] = and(bit_slice.943, or.1187, id=1217)
and.1219: bits[1] = and(bit_slice.942, bit_slice.1176, id=1219)
and.1220: bits[1] = and(bit_slice.942, or.1187, id=1220)
and.1222: bits[1] = and(bit_slice.941, bit_slice.1175, id=1222)
and.1223: bits[1] = and(bit_slice.941, or.1187, id=1223)
and.1225: bits[1] = and(bit_slice.940, bit_slice.1174, id=1225)
and.1226: bits[1] = and(bit_slice.940, or.1187, id=1226)
and.1228: bits[1] = and(bit_slice.939, bit_slice.1173, id=1228)
and.1229: bits[1] = and(bit_slice.939, or.1187, id=1229)
and.1231: bits[1] = and(bit_slice.938, bit_slice.1172, id=1231)
and.1232: bits[1] = and(bit_slice.938, or.1187, id=1232)
and.1234: bits[1] = and(bit_slice.937, bit_slice.1171, id=1234)
and.1235: bits[1] = and(bit_slice.937, or.1187, id=1235)
or.1237: bits[1] = or(and.1189, and.1190, id=1237)
and.1191: bits[1] = and(bit_slice.1186, not.1188, id=1191)
or.1239: bits[1] = or(and.1192, and.1193, id=1239)
and.1194: bits[1] = and(bit_slice.1185, not.1188, id=1194)
or.1241: bits[1] = or(and.1195, and.1196, id=1241)
and.1197: bits[1] = and(bit_slice.1184, not.1188, id=1197)
or.1243: bits[1] = or(and.1198, and.1199, id=1243)
and.1200: bits[1] = and(bit_slice.1183, not.1188, id=1200)
or.1245: bits[1] = or(and.1201, and.1202, id=1245)
and.1203: bits[1] = and(bit_slice.1182, not.1188, id=1203)
or.1247: bits[1] = or(and.1204, and.1205, id=1247)
and.1206: bits[1] = and(bit_slice.1181, not.1188, id=1206)
or.1249: bits[1] = or(and.1207, and.1208, id=1249)
and.1209: bits[1] = and(bit_slice.1180, not.1188, id=1209)
or.1251: bits[1] = or(and.1210, and.1211, id=1251)
and.1212: bits[1] = and(bit_slice.1179, not.1188, id=1212)
or.1253: bits[1] = or(and.1213, and.1214, id=1253)
and.1215: bits[1] = and(bit_slice.1178, not.1188, id=1215)
or.1255: bits[1] = or(and.1216, and.1217, id=1255)
and.1218: bits[1] = and(bit_slice.1177, not.1188, id=1218)
or.1257: bits[1] = or(and.1219, and.1220, id=1257)
and.1221: bits[1] = and(bit_slice.1176, not.1188, id=1221)
or.1259: bits[1] = or(and.1222, and.1223, id=1259)
and.1224: bits[1] = and(bit_slice.1175, not.1188, id=1224)
or.1261: bits[1] = or(and.1225, and.1226, id=1261)
and.1227: bits[1] = and(bit_slice.1174, not.1188, id=1227)
or.1263: bits[1] = or(and.1228, and.1229, id=1263)
and.1230: bits[1] = and(bit_slice.1173, not.1188, id=1230)
or.1265: bits[1] = or(and.1231, and.1232, id=1265)
and.1233: bits[1] = and(bit_slice.1172, not.1188, id=1233)
or.1267: bits[1] = or(and.1234, and.1235, id=1267)
and.1236: bits[1] = and(bit_slice.1171, not.1188, id=1236)
or.1238: bits[1] = or(or.1237, and.1191, id=1238)
or.1240: bits[1] = or(or.1239, and.1194, id=1240)
or.1242: bits[1] = or(or.1241, and.1197, id=1242)
or.1244: bits[1] = or(or.1243, and.1200, id=1244)
or.1246: bits[1] = or(or.1245, and.1203, id=1246)
or.1248: bits[1] = or(or.1247, and.1206, id=1248)
or.1250: bits[1] = or(or.1249, and.1209, id=1250)
or.1252: bits[1] = or(or.1251, and.1212, id=1252)
or.1254: bits[1] = or(or.1253, and.1215, id=1254)
or.1256: bits[1] = or(or.1255, and.1218, id=1256)
or.1258: bits[1] = or(or.1257, and.1221, id=1258)
or.1260: bits[1] = or(or.1259, and.1224, id=1260)
or.1262: bits[1] = or(or.1261, and.1227, id=1262)
or.1264: bits[1] = or(or.1263, and.1230, id=1264)
or.1266: bits[1] = or(or.1265, and.1233, id=1266)
or.1268: bits[1] = or(or.1267, and.1236, id=1268)
literal.916: bits[1] = literal(value=1, id=916)
literal.917: bits[1] = literal(value=0, id=917)
ret concat.1269: bits[16] = concat(or.1238, or.1240, or.1242, or.1244, or.1246, or.1248, or.1250, or.1252, or.1254, or.1256, or.1258, or.1260, or.1262, or.1264, or.1266, or.1268, id=1269)
}

View File

@@ -1,556 +0,0 @@
package my_package
fn kernel_sharpen(window: bits[8][9]) -> bits[8] {
literal.2853: bits[4] = literal(value=5, id=2853)
literal.2873: bits[4] = literal(value=7, id=2873)
array_index.2854: bits[8] = array_index(window, indices=[literal.2853], id=2854)
array_index.2874: bits[8] = array_index(window, indices=[literal.2873], id=2874)
literal.2813: bits[4] = literal(value=1, id=2813)
literal.2833: bits[4] = literal(value=3, id=2833)
bit_slice.2857: bits[1] = bit_slice(array_index.2854, start=2, width=1, id=2857)
bit_slice.2877: bits[1] = bit_slice(array_index.2874, start=2, width=1, id=2877)
array_index.2814: bits[8] = array_index(window, indices=[literal.2813], id=2814)
array_index.2834: bits[8] = array_index(window, indices=[literal.2833], id=2834)
and.2894: bits[1] = and(bit_slice.2857, bit_slice.2877, id=2894)
bit_slice.2817: bits[1] = bit_slice(array_index.2814, start=2, width=1, id=2817)
bit_slice.2837: bits[1] = bit_slice(array_index.2834, start=2, width=1, id=2837)
or.2893: bits[1] = or(bit_slice.2857, bit_slice.2877, id=2893)
not.2895: bits[1] = not(and.2894, id=2895)
and.2897: bits[1] = and(bit_slice.2817, bit_slice.2837, id=2897)
and.2907: bits[1] = and(bit_slice.2857, bit_slice.2877, id=2907)
and.2900: bits[1] = and(or.2893, not.2895, id=2900)
bit_slice.2856: bits[1] = bit_slice(array_index.2854, start=1, width=1, id=2856)
or.2896: bits[1] = or(bit_slice.2817, bit_slice.2837, id=2896)
not.2898: bits[1] = not(and.2897, id=2898)
or.2909: bits[1] = or(bit_slice.2857, bit_slice.2877, id=2909)
not.2908: bits[1] = not(and.2907, id=2908)
bit_slice.2876: bits[1] = bit_slice(array_index.2874, start=1, width=1, id=2876)
and.2901: bits[1] = and(and.2900, bit_slice.2856, id=2901)
and.2912: bits[1] = and(bit_slice.2817, bit_slice.2837, id=2912)
and.2904: bits[1] = and(or.2896, not.2898, id=2904)
bit_slice.2816: bits[1] = bit_slice(array_index.2814, start=1, width=1, id=2816)
and.2910: bits[1] = and(or.2909, not.2908, id=2910)
and.2911: bits[1] = and(bit_slice.2856, bit_slice.2876, id=2911)
and.2902: bits[1] = and(and.2901, bit_slice.2876, id=2902)
or.2914: bits[1] = or(bit_slice.2817, bit_slice.2837, id=2914)
not.2913: bits[1] = not(and.2912, id=2913)
bit_slice.2836: bits[1] = bit_slice(array_index.2834, start=1, width=1, id=2836)
bit_slice.2858: bits[1] = bit_slice(array_index.2854, start=3, width=1, id=2858)
bit_slice.2878: bits[1] = bit_slice(array_index.2874, start=3, width=1, id=2878)
and.2905: bits[1] = and(and.2904, bit_slice.2816, id=2905)
or.2925: bits[1] = or(and.2910, and.2911, id=2925)
not.2926: bits[1] = not(and.2902, id=2926)
and.2915: bits[1] = and(or.2914, not.2913, id=2915)
and.2916: bits[1] = and(bit_slice.2816, bit_slice.2836, id=2916)
and.2918: bits[1] = and(bit_slice.2858, bit_slice.2878, id=2918)
and.2935: bits[1] = and(bit_slice.2858, bit_slice.2878, id=2935)
bit_slice.2818: bits[1] = bit_slice(array_index.2814, start=3, width=1, id=2818)
bit_slice.2838: bits[1] = bit_slice(array_index.2834, start=3, width=1, id=2838)
and.2906: bits[1] = and(and.2905, bit_slice.2836, id=2906)
and.2945: bits[1] = and(or.2925, not.2926, id=2945)
or.2927: bits[1] = or(and.2915, and.2916, id=2927)
bit_slice.2859: bits[1] = bit_slice(array_index.2854, start=4, width=1, id=2859)
bit_slice.2879: bits[1] = bit_slice(array_index.2874, start=4, width=1, id=2879)
or.2917: bits[1] = or(bit_slice.2858, bit_slice.2878, id=2917)
not.2919: bits[1] = not(and.2918, id=2919)
and.2899: bits[1] = and(bit_slice.2857, bit_slice.2877, id=2899)
or.2937: bits[1] = or(bit_slice.2858, bit_slice.2878, id=2937)
not.2936: bits[1] = not(and.2935, id=2936)
and.2939: bits[1] = and(bit_slice.2818, bit_slice.2838, id=2939)
not.2928: bits[1] = not(and.2906, id=2928)
and.2946: bits[1] = and(and.2945, or.2927, id=2946)
and.2922: bits[1] = and(bit_slice.2818, bit_slice.2838, id=2922)
and.2949: bits[1] = and(bit_slice.2859, bit_slice.2879, id=2949)
and.2930: bits[1] = and(or.2917, not.2919, id=2930)
or.2920: bits[1] = or(and.2899, and.2902, id=2920)
and.2976: bits[1] = and(bit_slice.2859, bit_slice.2879, id=2976)
bit_slice.2819: bits[1] = bit_slice(array_index.2814, start=4, width=1, id=2819)
bit_slice.2839: bits[1] = bit_slice(array_index.2834, start=4, width=1, id=2839)
and.2938: bits[1] = and(or.2937, not.2936, id=2938)
or.2941: bits[1] = or(bit_slice.2818, bit_slice.2838, id=2941)
not.2940: bits[1] = not(and.2939, id=2940)
and.2943: bits[1] = and(or.2925, not.2926, id=2943)
and.2944: bits[1] = and(or.2927, not.2928, id=2944)
and.2947: bits[1] = and(and.2946, not.2928, id=2947)
or.2921: bits[1] = or(bit_slice.2818, bit_slice.2838, id=2921)
not.2923: bits[1] = not(and.2922, id=2923)
and.2903: bits[1] = and(bit_slice.2817, bit_slice.2837, id=2903)
bit_slice.2860: bits[1] = bit_slice(array_index.2854, start=5, width=1, id=2860)
bit_slice.2880: bits[1] = bit_slice(array_index.2874, start=5, width=1, id=2880)
or.2948: bits[1] = or(bit_slice.2859, bit_slice.2879, id=2948)
not.2950: bits[1] = not(and.2949, id=2950)
and.2929: bits[1] = and(bit_slice.2858, bit_slice.2878, id=2929)
and.2931: bits[1] = and(and.2930, or.2920, id=2931)
or.2978: bits[1] = or(bit_slice.2859, bit_slice.2879, id=2978)
not.2977: bits[1] = not(and.2976, id=2977)
and.2980: bits[1] = and(bit_slice.2819, bit_slice.2839, id=2980)
or.2956: bits[1] = or(and.2938, and.2899, id=2956)
and.2942: bits[1] = and(or.2941, not.2940, id=2942)
or.2962: bits[1] = or(and.2943, and.2944, id=2962)
not.2963: bits[1] = not(and.2947, id=2963)
and.2953: bits[1] = and(bit_slice.2819, bit_slice.2839, id=2953)
and.2933: bits[1] = and(or.2921, not.2923, id=2933)
or.2924: bits[1] = or(and.2903, and.2906, id=2924)
and.2995: bits[1] = and(bit_slice.2860, bit_slice.2880, id=2995)
and.2971: bits[1] = and(or.2948, not.2950, id=2971)
or.2951: bits[1] = or(and.2929, and.2931, id=2951)
and.3017: bits[1] = and(bit_slice.2860, bit_slice.2880, id=3017)
bit_slice.2820: bits[1] = bit_slice(array_index.2814, start=5, width=1, id=2820)
bit_slice.2840: bits[1] = bit_slice(array_index.2834, start=5, width=1, id=2840)
and.2979: bits[1] = and(or.2978, not.2977, id=2979)
or.2982: bits[1] = or(bit_slice.2819, bit_slice.2839, id=2982)
not.2981: bits[1] = not(and.2980, id=2981)
or.2957: bits[1] = or(or.2956, and.2902, id=2957)
not.2958: bits[1] = not(and.2931, id=2958)
or.2959: bits[1] = or(and.2942, and.2903, id=2959)
and.2989: bits[1] = and(or.2962, not.2963, id=2989)
or.2964: bits[1] = or(bit_slice.2856, bit_slice.2876, id=2964)
and.2965: bits[1] = and(bit_slice.2856, bit_slice.2876, id=2965)
or.2952: bits[1] = or(bit_slice.2819, bit_slice.2839, id=2952)
not.2954: bits[1] = not(and.2953, id=2954)
and.2932: bits[1] = and(bit_slice.2818, bit_slice.2838, id=2932)
and.2934: bits[1] = and(and.2933, or.2924, id=2934)
bit_slice.2861: bits[1] = bit_slice(array_index.2854, start=6, width=1, id=2861)
bit_slice.2881: bits[1] = bit_slice(array_index.2874, start=6, width=1, id=2881)
or.2994: bits[1] = or(bit_slice.2860, bit_slice.2880, id=2994)
not.2996: bits[1] = not(and.2995, id=2996)
and.2970: bits[1] = and(bit_slice.2859, bit_slice.2879, id=2970)
and.2972: bits[1] = and(and.2971, or.2951, id=2972)
or.3019: bits[1] = or(bit_slice.2860, bit_slice.2880, id=3019)
not.3018: bits[1] = not(and.3017, id=3018)
and.3021: bits[1] = and(bit_slice.2820, bit_slice.2840, id=3021)
or.3002: bits[1] = or(and.2979, and.2929, id=3002)
and.2983: bits[1] = and(or.2982, not.2981, id=2983)
and.2986: bits[1] = and(or.2957, not.2958, id=2986)
or.2960: bits[1] = or(or.2959, and.2906, id=2960)
and.2990: bits[1] = and(and.2989, or.2964, id=2990)
not.2966: bits[1] = not(and.2965, id=2966)
and.2999: bits[1] = and(bit_slice.2820, bit_slice.2840, id=2999)
and.2974: bits[1] = and(or.2952, not.2954, id=2974)
or.2955: bits[1] = or(and.2932, and.2934, id=2955)
and.3033: bits[1] = and(bit_slice.2861, bit_slice.2881, id=3033)
and.3012: bits[1] = and(or.2994, not.2996, id=3012)
or.2997: bits[1] = or(and.2970, and.2972, id=2997)
and.3055: bits[1] = and(bit_slice.2861, bit_slice.2881, id=3055)
bit_slice.2821: bits[1] = bit_slice(array_index.2814, start=6, width=1, id=2821)
bit_slice.2841: bits[1] = bit_slice(array_index.2834, start=6, width=1, id=2841)
and.3020: bits[1] = and(or.3019, not.3018, id=3020)
or.3023: bits[1] = or(bit_slice.2820, bit_slice.2840, id=3023)
not.3022: bits[1] = not(and.3021, id=3022)
or.3003: bits[1] = or(or.3002, and.2931, id=3003)
not.3004: bits[1] = not(and.2972, id=3004)
or.3005: bits[1] = or(and.2983, and.2932, id=3005)
not.2961: bits[1] = not(and.2934, id=2961)
and.2987: bits[1] = and(and.2986, or.2960, id=2987)
and.2991: bits[1] = and(and.2990, not.2966, id=2991)
or.2967: bits[1] = or(bit_slice.2816, bit_slice.2836, id=2967)
and.2968: bits[1] = and(bit_slice.2816, bit_slice.2836, id=2968)
or.2998: bits[1] = or(bit_slice.2820, bit_slice.2840, id=2998)
not.3000: bits[1] = not(and.2999, id=3000)
and.2973: bits[1] = and(bit_slice.2819, bit_slice.2839, id=2973)
and.2975: bits[1] = and(and.2974, or.2955, id=2975)
bit_slice.2862: bits[1] = bit_slice(array_index.2854, start=7, width=1, id=2862)
bit_slice.2882: bits[1] = bit_slice(array_index.2874, start=7, width=1, id=2882)
or.3032: bits[1] = or(bit_slice.2861, bit_slice.2881, id=3032)
not.3034: bits[1] = not(and.3033, id=3034)
and.3011: bits[1] = and(bit_slice.2860, bit_slice.2880, id=3011)
and.3013: bits[1] = and(and.3012, or.2997, id=3013)
or.3057: bits[1] = or(bit_slice.2861, bit_slice.2881, id=3057)
not.3056: bits[1] = not(and.3055, id=3056)
and.3059: bits[1] = and(bit_slice.2821, bit_slice.2841, id=3059)
or.3040: bits[1] = or(and.3020, and.2970, id=3040)
and.3024: bits[1] = and(or.3023, not.3022, id=3024)
and.3027: bits[1] = and(or.3003, not.3004, id=3027)
or.3006: bits[1] = or(or.3005, and.2934, id=3006)
and.2984: bits[1] = and(or.2957, not.2958, id=2984)
and.2985: bits[1] = and(or.2960, not.2961, id=2985)
and.2988: bits[1] = and(and.2987, not.2961, id=2988)
and.2992: bits[1] = and(and.2991, or.2967, id=2992)
not.2969: bits[1] = not(and.2968, id=2969)
and.3037: bits[1] = and(bit_slice.2821, bit_slice.2841, id=3037)
and.3015: bits[1] = and(or.2998, not.3000, id=3015)
or.3001: bits[1] = or(and.2973, and.2975, id=3001)
and.3087: bits[1] = and(bit_slice.2862, bit_slice.2882, id=3087)
and.3071: bits[1] = and(bit_slice.2862, bit_slice.2882, id=3071)
and.3050: bits[1] = and(or.3032, not.3034, id=3050)
or.3035: bits[1] = or(and.3011, and.3013, id=3035)
bit_slice.2822: bits[1] = bit_slice(array_index.2814, start=7, width=1, id=2822)
bit_slice.2842: bits[1] = bit_slice(array_index.2834, start=7, width=1, id=2842)
and.3058: bits[1] = and(or.3057, not.3056, id=3058)
or.3061: bits[1] = or(bit_slice.2821, bit_slice.2841, id=3061)
not.3060: bits[1] = not(and.3059, id=3060)
or.3041: bits[1] = or(or.3040, and.2972, id=3041)
not.3042: bits[1] = not(and.3013, id=3042)
or.3043: bits[1] = or(and.3024, and.2973, id=3043)
not.3007: bits[1] = not(and.2975, id=3007)
and.3028: bits[1] = and(and.3027, or.3006, id=3028)
or.3008: bits[1] = or(and.2984, and.2985, id=3008)
not.3009: bits[1] = not(and.2988, id=3009)
and.2993: bits[1] = and(and.2992, not.2969, id=2993)
or.3036: bits[1] = or(bit_slice.2821, bit_slice.2841, id=3036)
not.3038: bits[1] = not(and.3037, id=3038)
and.3014: bits[1] = and(bit_slice.2820, bit_slice.2840, id=3014)
and.3016: bits[1] = and(and.3015, or.3001, id=3016)
or.3089: bits[1] = or(bit_slice.2862, bit_slice.2882, id=3089)
not.3088: bits[1] = not(and.3087, id=3088)
or.3070: bits[1] = or(bit_slice.2862, bit_slice.2882, id=3070)
not.3072: bits[1] = not(and.3071, id=3072)
and.3049: bits[1] = and(bit_slice.2861, bit_slice.2881, id=3049)
and.3051: bits[1] = and(and.3050, or.3035, id=3051)
and.3093: bits[1] = and(bit_slice.2822, bit_slice.2842, id=3093)
or.3078: bits[1] = or(and.3058, and.3011, id=3078)
and.3062: bits[1] = and(or.3061, not.3060, id=3062)
and.3065: bits[1] = and(or.3041, not.3042, id=3065)
or.3044: bits[1] = or(or.3043, and.2975, id=3044)
and.3025: bits[1] = and(or.3003, not.3004, id=3025)
and.3026: bits[1] = and(or.3006, not.3007, id=3026)
and.3029: bits[1] = and(and.3028, not.3007, id=3029)
and.3030: bits[1] = and(or.3008, not.3009, id=3030)
or.3010: bits[1] = or(and.2947, and.2993, id=3010)
and.3075: bits[1] = and(bit_slice.2822, bit_slice.2842, id=3075)
and.3053: bits[1] = and(or.3036, not.3038, id=3053)
or.3039: bits[1] = or(and.3014, and.3016, id=3039)
and.3090: bits[1] = and(or.3089, not.3088, id=3090)
and.3091: bits[1] = and(or.3070, not.3072, id=3091)
or.3073: bits[1] = or(and.3049, and.3051, id=3073)
or.3095: bits[1] = or(bit_slice.2822, bit_slice.2842, id=3095)
not.3094: bits[1] = not(and.3093, id=3094)
or.3079: bits[1] = or(or.3078, and.3013, id=3079)
not.3080: bits[1] = not(and.3051, id=3080)
or.3081: bits[1] = or(and.3062, and.3014, id=3081)
not.3045: bits[1] = not(and.3016, id=3045)
and.3066: bits[1] = and(and.3065, or.3044, id=3066)
or.3046: bits[1] = or(and.3025, and.3026, id=3046)
not.3047: bits[1] = not(and.3029, id=3047)
and.3031: bits[1] = and(and.3030, or.3010, id=3031)
or.3074: bits[1] = or(bit_slice.2822, bit_slice.2842, id=3074)
not.3076: bits[1] = not(and.3075, id=3076)
and.3052: bits[1] = and(bit_slice.2821, bit_slice.2841, id=3052)
and.3054: bits[1] = and(and.3053, or.3039, id=3054)
or.3121: bits[1] = or(and.3090, and.3049, id=3121)
and.3092: bits[1] = and(and.3091, or.3073, id=3092)
and.3096: bits[1] = and(or.3095, not.3094, id=3096)
and.3101: bits[1] = and(or.3079, not.3080, id=3101)
or.3082: bits[1] = or(or.3081, and.3016, id=3082)
and.3063: bits[1] = and(or.3041, not.3042, id=3063)
and.3064: bits[1] = and(or.3044, not.3045, id=3064)
and.3067: bits[1] = and(and.3066, not.3045, id=3067)
and.3068: bits[1] = and(or.3046, not.3047, id=3068)
or.3048: bits[1] = or(and.2988, and.3031, id=3048)
and.3097: bits[1] = and(or.3074, not.3076, id=3097)
or.3077: bits[1] = or(and.3052, and.3054, id=3077)
or.3122: bits[1] = or(or.3121, and.3051, id=3122)
not.3123: bits[1] = not(and.3092, id=3123)
or.3124: bits[1] = or(and.3096, and.3052, id=3124)
not.3083: bits[1] = not(and.3054, id=3083)
and.3102: bits[1] = and(and.3101, or.3082, id=3102)
or.3084: bits[1] = or(and.3063, and.3064, id=3084)
not.3085: bits[1] = not(and.3067, id=3085)
and.3069: bits[1] = and(and.3068, or.3048, id=3069)
and.3098: bits[1] = and(and.3097, or.3077, id=3098)
and.3147: bits[1] = and(or.3122, not.3123, id=3147)
or.3125: bits[1] = or(or.3124, and.3054, id=3125)
and.3099: bits[1] = and(or.3079, not.3080, id=3099)
and.3100: bits[1] = and(or.3082, not.3083, id=3100)
and.3103: bits[1] = and(and.3102, not.3083, id=3103)
and.3104: bits[1] = and(or.3084, not.3085, id=3104)
or.3086: bits[1] = or(and.3029, and.3069, id=3086)
not.3126: bits[1] = not(and.3098, id=3126)
and.3148: bits[1] = and(and.3147, or.3125, id=3148)
or.3127: bits[1] = or(and.3099, and.3100, id=3127)
not.3128: bits[1] = not(and.3103, id=3128)
and.3105: bits[1] = and(and.3104, or.3086, id=3105)
and.3120: bits[1] = and(or.3084, not.3085, id=3120)
and.3106: bits[1] = and(or.3046, not.3047, id=3106)
and.3107: bits[1] = and(or.3008, not.3009, id=3107)
and.3109: bits[1] = and(or.2964, not.2966, id=3109)
and.3143: bits[1] = and(bit_slice.2862, bit_slice.2882, id=3143)
and.3144: bits[1] = and(bit_slice.2822, bit_slice.2842, id=3144)
and.3145: bits[1] = and(or.3122, not.3123, id=3145)
and.3146: bits[1] = and(or.3125, not.3126, id=3146)
and.3149: bits[1] = and(and.3148, not.3126, id=3149)
and.3150: bits[1] = and(or.3127, not.3128, id=3150)
or.3129: bits[1] = or(and.3067, and.3105, id=3129)
or.3140: bits[1] = or(and.3120, and.3029, id=3140)
or.3130: bits[1] = or(and.3106, and.2988, id=3130)
or.3133: bits[1] = or(and.3107, and.2947, id=3133)
and.3110: bits[1] = and(and.3109, or.2967, id=3110)
and.3112: bits[1] = and(bit_slice.2856, bit_slice.2876, id=3112)
and.3116: bits[1] = and(bit_slice.2816, bit_slice.2836, id=3116)
or.3183: bits[1] = or(and.3143, and.3092, id=3183)
or.3158: bits[1] = or(and.3143, and.3092, id=3158)
or.3159: bits[1] = or(and.3144, and.3098, id=3159)
or.3160: bits[1] = or(and.3145, and.3146, id=3160)
not.3161: bits[1] = not(and.3149, id=3161)
and.3151: bits[1] = and(and.3150, or.3129, id=3151)
or.3141: bits[1] = or(or.3140, and.3069, id=3141)
not.3142: bits[1] = not(and.3105, id=3142)
or.3131: bits[1] = or(or.3130, and.3031, id=3131)
not.3132: bits[1] = not(and.3069, id=3132)
or.3134: bits[1] = or(or.3133, and.2993, id=3134)
not.3135: bits[1] = not(and.3031, id=3135)
and.3108: bits[1] = and(or.2962, not.2963, id=3108)
and.3111: bits[1] = and(and.3110, not.2969, id=3111)
or.3114: bits[1] = or(bit_slice.2856, bit_slice.2876, id=3114)
not.3113: bits[1] = not(and.3112, id=3113)
or.3118: bits[1] = or(bit_slice.2816, bit_slice.2836, id=3118)
not.3117: bits[1] = not(and.3116, id=3117)
or.3184: bits[1] = or(or.3183, and.3144, id=3184)
and.3171: bits[1] = and(or.3158, or.3159, id=3171)
and.3172: bits[1] = and(or.3160, not.3161, id=3172)
or.3162: bits[1] = or(and.3103, and.3151, id=3162)
and.3152: bits[1] = and(or.3127, not.3128, id=3152)
and.3157: bits[1] = and(or.3141, not.3142, id=3157)
and.3153: bits[1] = and(or.3131, not.3132, id=3153)
and.3154: bits[1] = and(or.3134, not.3135, id=3154)
or.3136: bits[1] = or(and.3108, and.3111, id=3136)
not.3137: bits[1] = not(and.2993, id=3137)
and.3115: bits[1] = and(or.3114, not.3113, id=3115)
and.3119: bits[1] = and(or.3118, not.3117, id=3119)
or.3185: bits[1] = or(or.3184, and.3098, id=3185)
not.3186: bits[1] = not(and.3171, id=3186)
and.3173: bits[1] = and(and.3172, or.3162, id=3173)
and.3174: bits[1] = and(or.3160, not.3161, id=3174)
or.3163: bits[1] = or(and.3152, and.3067, id=3163)
not.3170: bits[1] = not(and.3157, id=3170)
not.3166: bits[1] = not(and.3153, id=3166)
not.3167: bits[1] = not(and.3154, id=3167)
and.3155: bits[1] = and(or.3136, not.3137, id=3155)
or.3138: bits[1] = or(and.3115, and.3119, id=3138)
not.3139: bits[1] = not(and.3111, id=3139)
and.3194: bits[1] = and(or.3185, not.3186, id=3194)
and.3195: bits[1] = and(or.3185, not.3186, id=3195)
or.3187: bits[1] = or(and.3149, and.3173, id=3187)
or.3188: bits[1] = or(and.3174, and.3103, id=3188)
or.3164: bits[1] = or(or.3163, and.3105, id=3164)
not.3165: bits[1] = not(and.3151, id=3165)
and.3179: bits[1] = and(not.3170, not.3166, id=3179)
and.3176: bits[1] = and(not.3166, not.3167, id=3176)
not.3168: bits[1] = not(and.3155, id=3168)
and.3156: bits[1] = and(or.3138, not.3139, id=3156)
or.3208: bits[1] = or(and.3194, and.3149, id=3208)
and.3196: bits[1] = and(and.3195, or.3187, id=3196)
or.3189: bits[1] = or(or.3188, and.3151, id=3189)
not.3190: bits[1] = not(and.3173, id=3190)
and.3175: bits[1] = and(or.3164, not.3165, id=3175)
and.3180: bits[1] = and(and.3179, not.3167, id=3180)
literal.2843: bits[4] = literal(value=4, id=2843)
and.3177: bits[1] = and(and.3176, not.3168, id=3177)
not.3169: bits[1] = not(and.3156, id=3169)
or.3209: bits[1] = or(or.3208, and.3173, id=3209)
not.3210: bits[1] = not(and.3196, id=3210)
and.3197: bits[1] = and(or.3189, not.3190, id=3197)
not.3191: bits[1] = not(and.3175, id=3191)
and.3181: bits[1] = and(and.3180, not.3168, id=3181)
array_index.2844: bits[8] = array_index(window, indices=[literal.2843], id=2844)
and.3178: bits[1] = and(and.3177, not.3169, id=3178)
and.3218: bits[1] = and(or.3209, not.3210, id=3218)
not.3211: bits[1] = not(and.3197, id=3211)
and.3198: bits[1] = and(not.3191, not.3170, id=3198)
and.3182: bits[1] = and(and.3181, not.3169, id=3182)
bit_slice.2846: bits[1] = bit_slice(array_index.2844, start=1, width=1, id=2846)
or.3192: bits[1] = or(not.3170, and.3178, id=3192)
not.3232: bits[1] = not(and.3218, id=3232)
and.3219: bits[1] = and(not.3211, not.3191, id=3219)
and.3199: bits[1] = and(and.3198, not.3166, id=3199)
not.3193: bits[1] = not(and.3182, id=3193)
and.3204: bits[1] = and(bit_slice.2846, or.3192, id=3204)
and.3238: bits[1] = and(not.3232, not.3211, id=3238)
and.3220: bits[1] = and(and.3219, not.3170, id=3220)
and.3200: bits[1] = and(and.3199, not.3167, id=3200)
and.3203: bits[1] = and(or.3192, not.3193, id=3203)
and.3205: bits[1] = and(and.3204, not.3193, id=3205)
and.3239: bits[1] = and(and.3238, not.3191, id=3239)
and.3221: bits[1] = and(and.3220, not.3166, id=3221)
and.3201: bits[1] = and(and.3200, not.3168, id=3201)
or.3214: bits[1] = or(bit_slice.2846, and.3203, id=3214)
not.3215: bits[1] = not(and.3205, id=3215)
and.3206: bits[1] = and(not.3167, not.3168, id=3206)
and.3240: bits[1] = and(and.3239, not.3170, id=3240)
and.3222: bits[1] = and(and.3221, not.3167, id=3222)
and.3202: bits[1] = and(and.3201, not.3169, id=3202)
bit_slice.2847: bits[1] = bit_slice(array_index.2844, start=2, width=1, id=2847)
or.3212: bits[1] = or(not.3191, and.3182, id=3212)
and.3228: bits[1] = and(or.3214, not.3215, id=3228)
bit_slice.2845: bits[1] = bit_slice(array_index.2844, start=0, width=1, id=2845)
and.3207: bits[1] = and(and.3206, not.3169, id=3207)
and.3241: bits[1] = and(and.3240, not.3166, id=3241)
and.3223: bits[1] = and(and.3222, not.3168, id=3223)
not.3213: bits[1] = not(and.3202, id=3213)
and.3226: bits[1] = and(bit_slice.2847, or.3212, id=3226)
and.3229: bits[1] = and(and.3228, bit_slice.2845, id=3229)
or.3216: bits[1] = or(not.3166, and.3207, id=3216)
and.3242: bits[1] = and(and.3241, not.3167, id=3242)
and.3224: bits[1] = and(and.3223, not.3169, id=3224)
bit_slice.2848: bits[1] = bit_slice(array_index.2844, start=3, width=1, id=2848)
or.3233: bits[1] = or(not.3211, and.3202, id=3233)
and.3225: bits[1] = and(or.3212, not.3213, id=3225)
and.3227: bits[1] = and(and.3226, not.3213, id=3227)
and.3230: bits[1] = and(and.3229, or.3216, id=3230)
not.3217: bits[1] = not(and.3178, id=3217)
and.3243: bits[1] = and(and.3242, not.3168, id=3243)
not.3234: bits[1] = not(and.3224, id=3234)
and.3246: bits[1] = and(bit_slice.2848, or.3233, id=3246)
or.3235: bits[1] = or(bit_slice.2847, and.3225, id=3235)
not.3236: bits[1] = not(and.3227, id=3236)
and.3231: bits[1] = and(and.3230, not.3217, id=3231)
and.3244: bits[1] = and(and.3243, not.3169, id=3244)
bit_slice.2849: bits[1] = bit_slice(array_index.2844, start=4, width=1, id=2849)
or.3250: bits[1] = or(not.3232, and.3224, id=3250)
and.3245: bits[1] = and(or.3233, not.3234, id=3245)
and.3247: bits[1] = and(and.3246, not.3234, id=3247)
and.3248: bits[1] = and(or.3235, not.3236, id=3248)
or.3237: bits[1] = or(and.3205, and.3231, id=3237)
not.3251: bits[1] = not(and.3244, id=3251)
and.3256: bits[1] = and(bit_slice.2849, or.3250, id=3256)
or.3252: bits[1] = or(bit_slice.2848, and.3245, id=3252)
not.3253: bits[1] = not(and.3247, id=3253)
and.3249: bits[1] = and(and.3248, or.3237, id=3249)
and.3255: bits[1] = and(or.3250, not.3251, id=3255)
and.3257: bits[1] = and(and.3256, not.3251, id=3257)
and.3258: bits[1] = and(or.3252, not.3253, id=3258)
or.3254: bits[1] = or(and.3227, and.3249, id=3254)
and.3266: bits[1] = and(or.3252, not.3253, id=3266)
or.3260: bits[1] = or(bit_slice.2849, and.3255, id=3260)
not.3261: bits[1] = not(and.3257, id=3261)
and.3259: bits[1] = and(and.3258, or.3254, id=3259)
or.3276: bits[1] = or(and.3266, and.3227, id=3276)
and.3267: bits[1] = and(or.3235, not.3236, id=3267)
and.3263: bits[1] = and(or.3260, not.3261, id=3263)
and.3264: bits[1] = and(or.3260, not.3261, id=3264)
or.3262: bits[1] = or(and.3247, and.3259, id=3262)
or.3277: bits[1] = or(or.3276, and.3249, id=3277)
not.3278: bits[1] = not(and.3259, id=3278)
or.3279: bits[1] = or(and.3267, and.3205, id=3279)
and.3269: bits[1] = and(bit_slice.2845, or.3216, id=3269)
and.3271: bits[1] = and(or.3216, not.3217, id=3271)
or.3273: bits[1] = or(and.3263, and.3247, id=3273)
and.3265: bits[1] = and(and.3264, or.3262, id=3265)
and.3292: bits[1] = and(or.3277, not.3278, id=3292)
or.3280: bits[1] = or(or.3279, and.3231, id=3280)
and.3268: bits[1] = and(or.3214, not.3215, id=3268)
and.3270: bits[1] = and(and.3269, not.3217, id=3270)
and.3298: bits[1] = and(or.3277, not.3278, id=3298)
or.3284: bits[1] = or(bit_slice.2845, and.3271, id=3284)
or.3274: bits[1] = or(or.3273, and.3259, id=3274)
not.3275: bits[1] = not(and.3265, id=3275)
and.3293: bits[1] = and(and.3292, or.3280, id=3293)
not.3281: bits[1] = not(and.3249, id=3281)
and.3295: bits[1] = and(or.3277, not.3278, id=3295)
or.3282: bits[1] = or(and.3268, and.3270, id=3282)
and.3299: bits[1] = and(and.3298, or.3284, id=3299)
not.3285: bits[1] = not(and.3270, id=3285)
and.3272: bits[1] = and(not.3168, not.3169, id=3272)
and.3288: bits[1] = and(or.3274, not.3275, id=3288)
and.3289: bits[1] = and(or.3277, not.3278, id=3289)
and.3294: bits[1] = and(and.3293, not.3281, id=3294)
and.3296: bits[1] = and(and.3295, or.3282, id=3296)
not.3283: bits[1] = not(and.3231, id=3283)
and.3300: bits[1] = and(and.3299, not.3285, id=3300)
or.3286: bits[1] = or(not.3167, and.3272, id=3286)
or.3303: bits[1] = or(and.3288, and.3289, id=3303)
and.3290: bits[1] = and(or.3280, not.3281, id=3290)
or.3311: bits[1] = or(and.3288, and.3294, id=3311)
and.3297: bits[1] = and(and.3296, not.3283, id=3297)
and.3301: bits[1] = and(and.3300, or.3286, id=3301)
not.3287: bits[1] = not(and.3207, id=3287)
or.3304: bits[1] = or(or.3303, and.3290, id=3304)
and.3291: bits[1] = and(or.3282, not.3283, id=3291)
or.3306: bits[1] = or(and.3288, and.3294, id=3306)
or.3312: bits[1] = or(or.3311, and.3297, id=3312)
and.3302: bits[1] = and(and.3301, not.3287, id=3302)
or.3305: bits[1] = or(or.3304, and.3291, id=3305)
or.3307: bits[1] = or(or.3306, and.3297, id=3307)
or.3313: bits[1] = or(or.3312, and.3302, id=3313)
not.3309: bits[1] = not(or.3305, id=3309)
or.3308: bits[1] = or(or.3307, and.3302, id=3308)
or.3318: bits[1] = or(not.3168, not.3169, id=3318)
not.3319: bits[1] = not(and.3272, id=3319)
or.3314: bits[1] = or(or.3313, not.3309, id=3314)
and.3322: bits[1] = and(or.3284, not.3285, id=3322)
not.3310: bits[1] = not(or.3308, id=3310)
and.3328: bits[1] = and(or.3286, not.3287, id=3328)
and.3333: bits[1] = and(or.3318, not.3319, id=3333)
and.3338: bits[1] = and(or.3138, not.3139, id=3338)
and.3320: bits[1] = and(or.3284, not.3285, id=3320)
not.3316: bits[1] = not(or.3314, id=3316)
and.3323: bits[1] = and(and.3322, not.3310, id=3323)
and.3315: bits[1] = and(not.3310, not.3309, id=3315)
and.3326: bits[1] = and(or.3286, not.3287, id=3326)
and.3329: bits[1] = and(and.3328, not.3310, id=3329)
and.3331: bits[1] = and(or.3318, not.3319, id=3331)
and.3334: bits[1] = and(and.3333, not.3310, id=3334)
and.3336: bits[1] = and(or.3138, not.3139, id=3336)
and.3339: bits[1] = and(and.3338, not.3310, id=3339)
and.3341: bits[1] = and(or.3282, not.3283, id=3341)
and.3321: bits[1] = and(and.3320, not.3316, id=3321)
and.3324: bits[1] = and(and.3323, not.3309, id=3324)
not.3317: bits[1] = not(and.3315, id=3317)
and.3327: bits[1] = and(and.3326, not.3316, id=3327)
and.3330: bits[1] = and(and.3329, not.3309, id=3330)
and.3332: bits[1] = and(and.3331, not.3316, id=3332)
and.3335: bits[1] = and(and.3334, not.3309, id=3335)
and.3337: bits[1] = and(and.3336, not.3316, id=3337)
and.3340: bits[1] = and(and.3339, not.3309, id=3340)
literal.2803: bits[4] = literal(value=0, id=2803)
literal.2823: bits[4] = literal(value=2, id=2823)
literal.2863: bits[4] = literal(value=6, id=2863)
literal.2883: bits[4] = literal(value=8, id=2883)
and.3342: bits[1] = and(and.3341, not.3310, id=3342)
or.3344: bits[1] = or(and.3321, and.3324, id=3344)
and.3325: bits[1] = and(not.3316, not.3317, id=3325)
or.3346: bits[1] = or(and.3327, and.3330, id=3346)
or.3348: bits[1] = or(and.3332, and.3335, id=3348)
or.3350: bits[1] = or(and.3337, and.3340, id=3350)
array_index.2804: bits[8] = array_index(window, indices=[literal.2803], id=2804)
array_index.2824: bits[8] = array_index(window, indices=[literal.2823], id=2824)
array_index.2864: bits[8] = array_index(window, indices=[literal.2863], id=2864)
array_index.2884: bits[8] = array_index(window, indices=[literal.2883], id=2884)
literal.2801: bits[1] = literal(value=0, id=2801)
and.3343: bits[1] = and(and.3342, not.3309, id=3343)
or.3345: bits[1] = or(or.3344, and.3325, id=3345)
or.3347: bits[1] = or(or.3346, and.3325, id=3347)
or.3349: bits[1] = or(or.3348, and.3325, id=3349)
or.3351: bits[1] = or(or.3350, and.3325, id=3351)
literal.2800: bits[1] = literal(value=1, id=2800)
bit_slice.2805: bits[1] = bit_slice(array_index.2804, start=0, width=1, id=2805)
bit_slice.2806: bits[1] = bit_slice(array_index.2804, start=1, width=1, id=2806)
bit_slice.2807: bits[1] = bit_slice(array_index.2804, start=2, width=1, id=2807)
bit_slice.2808: bits[1] = bit_slice(array_index.2804, start=3, width=1, id=2808)
bit_slice.2809: bits[1] = bit_slice(array_index.2804, start=4, width=1, id=2809)
bit_slice.2810: bits[1] = bit_slice(array_index.2804, start=5, width=1, id=2810)
bit_slice.2811: bits[1] = bit_slice(array_index.2804, start=6, width=1, id=2811)
bit_slice.2812: bits[1] = bit_slice(array_index.2804, start=7, width=1, id=2812)
bit_slice.2815: bits[1] = bit_slice(array_index.2814, start=0, width=1, id=2815)
bit_slice.2825: bits[1] = bit_slice(array_index.2824, start=0, width=1, id=2825)
bit_slice.2826: bits[1] = bit_slice(array_index.2824, start=1, width=1, id=2826)
bit_slice.2827: bits[1] = bit_slice(array_index.2824, start=2, width=1, id=2827)
bit_slice.2828: bits[1] = bit_slice(array_index.2824, start=3, width=1, id=2828)
bit_slice.2829: bits[1] = bit_slice(array_index.2824, start=4, width=1, id=2829)
bit_slice.2830: bits[1] = bit_slice(array_index.2824, start=5, width=1, id=2830)
bit_slice.2831: bits[1] = bit_slice(array_index.2824, start=6, width=1, id=2831)
bit_slice.2832: bits[1] = bit_slice(array_index.2824, start=7, width=1, id=2832)
bit_slice.2835: bits[1] = bit_slice(array_index.2834, start=0, width=1, id=2835)
bit_slice.2850: bits[1] = bit_slice(array_index.2844, start=5, width=1, id=2850)
bit_slice.2851: bits[1] = bit_slice(array_index.2844, start=6, width=1, id=2851)
bit_slice.2852: bits[1] = bit_slice(array_index.2844, start=7, width=1, id=2852)
bit_slice.2855: bits[1] = bit_slice(array_index.2854, start=0, width=1, id=2855)
bit_slice.2865: bits[1] = bit_slice(array_index.2864, start=0, width=1, id=2865)
bit_slice.2866: bits[1] = bit_slice(array_index.2864, start=1, width=1, id=2866)
bit_slice.2867: bits[1] = bit_slice(array_index.2864, start=2, width=1, id=2867)
bit_slice.2868: bits[1] = bit_slice(array_index.2864, start=3, width=1, id=2868)
bit_slice.2869: bits[1] = bit_slice(array_index.2864, start=4, width=1, id=2869)
bit_slice.2870: bits[1] = bit_slice(array_index.2864, start=5, width=1, id=2870)
bit_slice.2871: bits[1] = bit_slice(array_index.2864, start=6, width=1, id=2871)
bit_slice.2872: bits[1] = bit_slice(array_index.2864, start=7, width=1, id=2872)
bit_slice.2875: bits[1] = bit_slice(array_index.2874, start=0, width=1, id=2875)
bit_slice.2885: bits[1] = bit_slice(array_index.2884, start=0, width=1, id=2885)
bit_slice.2886: bits[1] = bit_slice(array_index.2884, start=1, width=1, id=2886)
bit_slice.2887: bits[1] = bit_slice(array_index.2884, start=2, width=1, id=2887)
bit_slice.2888: bits[1] = bit_slice(array_index.2884, start=3, width=1, id=2888)
bit_slice.2889: bits[1] = bit_slice(array_index.2884, start=4, width=1, id=2889)
bit_slice.2890: bits[1] = bit_slice(array_index.2884, start=5, width=1, id=2890)
bit_slice.2891: bits[1] = bit_slice(array_index.2884, start=6, width=1, id=2891)
bit_slice.2892: bits[1] = bit_slice(array_index.2884, start=7, width=1, id=2892)
ret concat.3352: bits[8] = concat(literal.2801, literal.2801, literal.2801, and.3343, or.3345, or.3347, or.3349, or.3351, id=3352)
}

View File

@@ -1,434 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of CUDASTF in CUDA C++ Core Libraries,
// under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
/**
* @file
* @brief This shows how we can asynchronously compose a sequence of operations
* described with an IR
*/
#include <cuda/experimental/stf.cuh>
#include <fstream>
#include <iostream>
#include <map>
using namespace cuda::experimental::stf;
using logical_slice = logical_data<slice<double>>;
static __global__ void cuda_sleep_kernel(long long int clock_cnt)
{
long long int start_clock = clock64();
long long int clock_offset = 0;
while (clock_offset < clock_cnt)
{
clock_offset = clock64() - start_clock;
}
}
void cuda_sleep(double ms, cudaStream_t stream)
{
int device;
cudaGetDevice(&device);
// cudaDevAttrClockRate: Peak clock frequency in kilohertz;
int clock_rate;
cudaDeviceGetAttribute(&clock_rate, cudaDevAttrClockRate, device);
long long int clock_cnt = (long long int) (ms * clock_rate);
cuda_sleep_kernel<<<1, 1, 0, stream>>>(clock_cnt);
}
const double sleep_time = 1.0;
// z = LITERAL(length, value)
template <typename Ctx>
logical_slice LITERAL(Ctx& ctx, size_t n, int, std::string out_symbol = "undefined")
{
auto z = ctx.logical_data(shape_of<slice<double>>(n));
z.set_symbol(out_symbol);
ctx.task(z.write()).set_symbol("LITERAL")->*[](cudaStream_t stream, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return z;
}
// z = OR(x,y)
template <typename Ctx>
logical_slice OR(Ctx& ctx, logical_slice x, logical_slice y, std::string out_symbol = "undefined")
{
assert(x.shape().size() == y.shape().size());
auto z = ctx.logical_data(x.shape());
z.set_symbol(out_symbol);
ctx.task(x.read(), y.read(), z.write()).set_symbol("OR")->*
[](cudaStream_t stream, auto /*unused*/, auto /*unused*/, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return z;
}
// z = AND(x,y)
template <typename Ctx>
logical_slice AND(Ctx& ctx, logical_slice x, logical_slice y, std::string out_symbol = "undefined")
{
assert(x.shape().size() == y.shape().size());
auto z = ctx.logical_data(x.shape());
z.set_symbol(out_symbol);
ctx.task(x.read(), y.read(), z.write()).set_symbol("AND")->*
[](cudaStream_t stream, auto /*unused*/, auto /*unused*/, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return z;
}
template <typename Ctx>
logical_slice
ARRAY_INDEX(Ctx& ctx, logical_slice x, logical_slice /*unused*/, size_t sz, std::string out_symbol = "undefined")
{
auto z = ctx.logical_data(shape_of<slice<double>>(sz));
z.set_symbol(out_symbol);
ctx.task(x.read(), z.write()).set_symbol("ARRAY INDEX")->*[](cudaStream_t stream, auto /*unused*/, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return z;
}
// z = BIT_SLICE(x, position, size)
template <typename Ctx>
logical_slice BIT_SLICE(Ctx& ctx, logical_slice x, size_t /*unused*/, size_t sz, std::string out_symbol = "undefined")
{
auto z = ctx.logical_data(shape_of<slice<double>>(sz));
z.set_symbol(out_symbol);
ctx.task(x.read(), z.write()).set_symbol("BIT SLICE")->*[](cudaStream_t stream, auto /*unused*/, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return z;
}
// y = NOT(x)
template <typename Ctx>
logical_slice NOT(Ctx& ctx, logical_slice x, std::string out_symbol = "undefined")
{
auto y = ctx.logical_data(x.shape());
y.set_symbol(out_symbol);
ctx.task(x.read(), y.write()).set_symbol("NOT")->*[](cudaStream_t stream, auto /*unused*/, auto /*unused*/) {
cuda_sleep(sleep_time, stream);
};
return y;
}
// y = CONCAT(sz, vector<> inputs)
template <typename Ctx>
logical_slice CONCAT(Ctx& ctx, size_t sz, std::vector<logical_slice> inputs, std::string out_symbol = "undefined")
{
auto y = ctx.logical_data(shape_of<slice<double>>(sz));
y.set_symbol(out_symbol);
auto t = ctx.task();
t.add_deps(y.write());
t.set_symbol("CONCAT");
for (auto& input : inputs)
{
t.add_deps(input.read());
}
t->*[](cudaStream_t stream) {
cuda_sleep(sleep_time, stream);
};
return y;
}
template <typename Ctx>
void run(const char* inputfile)
{
// Find the handle from its symbol
std::map<std::string, logical_slice> logical_slices;
std::string output_data_symbol;
std::ifstream read(inputfile);
Ctx ctx;
// Indicates if we are parsing the body of the circuit
bool in_body = false;
for (std::string line; std::getline(read, line);)
{
std::stringstream ss(line);
// std::cout << "LINE : " << line << '\n';
if (!in_body)
{
std::string token;
ss >> token;
// std::cout << "TOKEN : " << token << '\n';
if (token == "fn")
{
// We are parsing the declaration of the function, this starts the body
// std::cout << "GOT DECLARATION " << line << '\n';
in_body = true;
// Look for parameters
size_t begin_params, end_params;
begin_params = line.find('(');
end_params = line.find(')');
std::string params = line.substr(begin_params + 1, end_params - begin_params - 1);
// std::cout << "PARAMS = " << params << '\n';
// Parse parameters which are separated by a comma, format = "symbol: type"
while (true)
{
// Find symbol
size_t pos;
pos = params.find(":");
std::string symbol = params.substr(0, pos);
// std::cout << symbol << '\n';
// We create a dummy allocation so that the data handles refers to actually allocated host memory
double* dummy = new double[1];
auto param_handle = ctx.logical_data(make_slice(dummy, 1));
param_handle.set_symbol(symbol);
logical_slices[symbol] = param_handle;
pos = params.find(", ");
if (pos == std::string::npos)
{
break;
}
params.erase(0, pos + 2);
}
}
}
else
{
std::string token;
ss >> token;
// std::cout << "TOKEN : " << token << '\n';
if (token == "}")
{
// This closes the body
in_body = false;
continue;
}
// We expect lines of the format : " symbol: type = gate_name(..., id=VALUE)"
size_t end_symbol = line.find(":");
// We look for the first "= " to find the gate name
size_t gate_symbol_pos = line.find("= ");
std::string gate = line.substr(gate_symbol_pos + 2);
size_t gate_name_end = gate.find("(");
std::string gate_symbol = gate.substr(0, gate_name_end);
std::string gate_args = gate.substr(gate_name_end + 1, gate.size() - gate_name_end - 2);
std::string gate_outvar_symbol = line.substr(2, end_symbol - 2);
// Possibly remove the "ret" out of the gate_outvar_symbol
size_t ret_pos = gate_outvar_symbol.find("ret ");
if (ret_pos != std::string::npos)
{
// This is our result !
gate_outvar_symbol.erase(4);
output_data_symbol = gate_outvar_symbol;
}
// std::cout << "GATE OUT SYMBOL " << gate_outvar_symbol << '\n';
// std::cout << "GATE DESCRIPTION : " << gate << '\n';
// std::cout << "GATE SYMBOL " << gate_symbol << '\n';
// std::cout << "GATE ARGS " << gate_args << '\n';
// We now dispatch between the different gates
if (gate_symbol == "literal")
{
// literal.916: bits[1] = literal(value=1, id=916)
int value = 42; // TODO parse
size_t sz = 1;
logical_slices[gate_outvar_symbol] = LITERAL(ctx, sz, value, gate_outvar_symbol);
continue;
}
if (gate_symbol == "or")
{
// or.1268: bits[1] = or(or.1267, and.1236, id=1268)
size_t pos;
pos = gate_args.find(", ");
std::string symbol_left = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
pos = gate_args.find(", ");
std::string symbol_right = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
// std::cout << "OR GATE on symbols" << symbol_left << " AND " << symbol_right << '\n';
auto data_left = logical_slices[symbol_left];
auto data_right = logical_slices[symbol_right];
logical_slices[gate_outvar_symbol] = OR(ctx, data_left, data_right, gate_outvar_symbol);
continue;
}
if (gate_symbol == "and")
{
size_t pos;
pos = gate_args.find(", ");
std::string symbol_left = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
pos = gate_args.find(", ");
std::string symbol_right = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
auto data_left = logical_slices[symbol_left];
auto data_right = logical_slices[symbol_right];
logical_slices[gate_outvar_symbol] = AND(ctx, data_left, data_right, gate_outvar_symbol);
continue;
}
if (gate_symbol == "bit_slice")
{
// bit_slice.936: bits[1] = bit_slice(y, start=15, width=1, id=936)
size_t pos;
pos = gate_args.find(", ");
std::string symbol_in = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
// hardcoded ...
size_t sz = 1;
auto data_in = logical_slices[symbol_in];
logical_slices[gate_outvar_symbol] = BIT_SLICE(ctx, data_in, 42, sz, gate_outvar_symbol);
// std::cout << "PRODUCED DATA FOR " << gate_outvar_symbol << '\n';
continue;
}
if (gate_symbol == "array_index")
{
// array_index.2804: bits[8] = array_index(window, indices=[literal.2803], id=2804)
size_t pos;
pos = gate_args.find(", ");
std::string symbol_in = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
pos = gate_args.find(", ");
std::string symbol_indices = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
size_t pos_beg = symbol_indices.find("[");
size_t pos_end = symbol_indices.find("]");
std::string symbol_in_2 = symbol_indices.substr(pos_beg + 1, pos_end - pos_beg - 1);
// std::cout << "ARRAY INDEX ... INDEX = " << symbol_in_2 << '\n';
// hardcoded ...
size_t sz = 1;
auto data_in = logical_slices[symbol_in];
auto data_in_2 = logical_slices[symbol_in_2];
logical_slices[gate_outvar_symbol] = ARRAY_INDEX(ctx, data_in, data_in_2, sz, gate_outvar_symbol);
// std::cout << "PRODUCED DATA FOR " << gate_outvar_symbol << '\n';
continue;
}
if (gate_symbol == "not")
{
// not.953: bits[1] = not(bit_slice.936, id=953)
size_t pos;
pos = gate_args.find(", ");
std::string symbol_in = gate_args.substr(0, pos);
gate_args.erase(0, pos + 2);
auto data_in = logical_slices[symbol_in];
logical_slices[gate_outvar_symbol] = NOT(ctx, data_in, gate_outvar_symbol);
continue;
}
if (gate_symbol == "concat")
{
// ret concat.1269: bits[16] = concat(or.1238, or.1240, or.1242, or.1244, or.1246, or.1248, or.1250,
// or.1252, or.1254, or.1256, or.1258, or.1260, or.1262, or.1264, or.1266, or.1268, id=1269)
// Remove the end ", id =.."
size_t id_pos = gate_args.find(", id=");
gate_args = gate_args.substr(0, id_pos);
std::vector<logical_slice> inputs;
size_t pos;
while (true)
{
pos = gate_args.find(", ");
if (pos == std::string::npos)
{
break;
}
std::string symbol = gate_args.substr(0, pos);
inputs.push_back(logical_slices[symbol]);
gate_args.erase(0, pos + 2);
// std::cout << "CONCAT ARG = " << symbol << '\n';
}
size_t sz = 1;
logical_slices[gate_outvar_symbol] = CONCAT(ctx, sz, inputs, gate_outvar_symbol);
continue;
}
std::cout << "UNRECOGNIZED GATE !" << '\n';
abort();
}
}
auto output_data = logical_slices[output_data_symbol];
ctx.finalize();
}
int main(int argc, char** argv)
{
/* Until we find a simple and "safe" way to pass a file to the test, we
* consider this is not an error ...
* One possible approach would be to convert a default .ir file to a large
* static data processed in the test suite ?
*/
if (argc < 2)
{
fprintf(stderr, "This test needs an input file, skipping.\n");
return 0;
}
run<stream_ctx>(argv[1]);
run<graph_ctx>(argv[1]);
}