@@ -698,6 +698,137 @@ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
698698 ARG(0), ARG(1), ARG(2), ARG(3), ARG(4),
699699 DEREF(makeCallArgCreatorWithCall(5))))))
700700
701+ CONDITIONAL_FACTORY_ENTRY(
702+ UseExpVirtualMemory,
703+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
704+ HelperFeatureEnum::device_ext,
705+ ASSIGN_FACTORY_ENTRY(
706+ "cuMemCreate", DEREF(0),
707+ NEW(MapNames::getClNamespace() +
708+ "ext::oneapi::experimental::physical_mem",
709+ CALL(MapNames::getDpctNamespace() + "get_device",
710+ MEMBER_EXPR(DEREF(2), false, LITERAL("location.id"))),
711+ MEMBER_CALL(CALL(MapNames::getDpctNamespace() + "get_device",
712+ MEMBER_EXPR(DEREF(2), false,
713+ LITERAL("location.id"))),
714+ false, "get_context"),
715+ ARG(1))))),
716+ UNSUPPORT_FACTORY_ENTRY("cuMemCreate",
717+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
718+ ARG("cuMemCreate"),
719+ ARG("--use-experimental-features=virtual_memory")))
720+
721+ CONDITIONAL_FACTORY_ENTRY(
722+ UseExpVirtualMemory,
723+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
724+ HelperFeatureEnum::device_ext,
725+ ASSIGN_FACTORY_ENTRY(
726+ "cuMemAddressReserve", DEREF(0),
727+ CALL("(" + MapNames::getDpctNamespace() + "device_ptr)" +
728+ MapNames::getClNamespace() +
729+ "ext::oneapi::experimental::reserve_virtual_mem",
730+ CAST(LITERAL("uintptr_t"), ARG(3)), ARG(1),
731+ LITERAL(MapNames::getDpctNamespace() +
732+ "get_current_device().get_context()"))))),
733+ UNSUPPORT_FACTORY_ENTRY("cuMemAddressReserve",
734+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
735+ ARG("cuMemAddressReserve"),
736+ ARG("--use-experimental-features=virtual_memory")))
737+
738+ CONDITIONAL_FACTORY_ENTRY(
739+ UseExpVirtualMemory,
740+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
741+ HelperFeatureEnum::device_ext,
742+ CALL_FACTORY_ENTRY(
743+ "cuMemAddressFree",
744+ CALL(MapNames::getClNamespace() +
745+ "ext::oneapi::experimental::free_virtual_mem",
746+ CAST(LITERAL("uintptr_t"), ARG(0)), ARG(1),
747+ LITERAL(MapNames::getDpctNamespace() +
748+ "get_current_device().get_context()"))))),
749+ UNSUPPORT_FACTORY_ENTRY("cuMemAddressFree",
750+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
751+ ARG("cuMemAddressFree"),
752+ ARG("--use-experimental-features=virtual_memory")))
753+
754+ CONDITIONAL_FACTORY_ENTRY(
755+ UseExpVirtualMemory,
756+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
757+ HelperFeatureEnum::device_ext,
758+ ASSIGN_FACTORY_ENTRY(
759+ "cuMemGetAllocationGranularity", DEREF(0),
760+ CALL(MapNames::getClNamespace() +
761+ "ext::oneapi::experimental::get_mem_granularity",
762+ CALL(MapNames::getDpctNamespace() + "get_device",
763+ MEMBER_EXPR(DEREF(1), false, LITERAL("location.id"))),
764+ MEMBER_CALL(CALL(MapNames::getDpctNamespace() + "get_device",
765+ MEMBER_EXPR(DEREF(1), false,
766+ LITERAL("location.id"))),
767+ false, "get_context"),
768+ ARG(2))))),
769+ UNSUPPORT_FACTORY_ENTRY("cuMemGetAllocationGranularity",
770+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
771+ ARG("cuMemGetAllocationGranularity"),
772+ ARG("--use-experimental-features=virtual_memory")))
773+
774+ CONDITIONAL_FACTORY_ENTRY(
775+ UseExpVirtualMemory,
776+ ASSIGNABLE_FACTORY(
777+ FEATURE_REQUEST_FACTORY(HelperFeatureEnum::device_ext,
778+ DELETE_FACTORY_ENTRY("cuMemRelease", ARG(0)))),
779+ UNSUPPORT_FACTORY_ENTRY("cuMemRelease",
780+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
781+ ARG("cuMemRelease"),
782+ ARG("--use-experimental-features=virtual_memory")))
783+
784+ CONDITIONAL_FACTORY_ENTRY(
785+ UseExpVirtualMemory,
786+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
787+ HelperFeatureEnum::device_ext,
788+ MEMBER_CALL_FACTORY_ENTRY(
789+ "cuMemMap", ARG(3), true, "map", CAST(LITERAL("uintptr_t"), ARG(0)),
790+ ARG(1),
791+ LITERAL(
792+ MapNames::getClNamespace() +
793+ "ext::oneapi::experimental::address_access_mode::read_write"),
794+ ARG(2)))),
795+ UNSUPPORT_FACTORY_ENTRY("cuMemMap", Diagnostics::TRY_EXPERIMENTAL_FEATURE,
796+ ARG("cuMemMap"),
797+ ARG("--use-experimental-features=virtual_memory")))
798+
799+ CONDITIONAL_FACTORY_ENTRY(
800+ UseExpVirtualMemory,
801+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
802+ HelperFeatureEnum::device_ext,
803+ CALL_FACTORY_ENTRY(
804+ "cuMemUnmap",
805+ CALL(MapNames::getClNamespace() +
806+ "ext::oneapi::experimental::unmap",
807+ ARG(0), ARG(1),
808+ LITERAL(MapNames::getDpctNamespace() +
809+ "get_current_device().get_context()"))))),
810+ UNSUPPORT_FACTORY_ENTRY("cuMemUnmap", Diagnostics::TRY_EXPERIMENTAL_FEATURE,
811+ ARG("cuMemUnmap"),
812+ ARG("--use-experimental-features=virtual_memory")))
813+
814+ CONDITIONAL_FACTORY_ENTRY(
815+ UseExpVirtualMemory,
816+ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY(
817+ HelperFeatureEnum::device_ext,
818+ CALL_FACTORY_ENTRY(
819+ "cuMemSetAccess",
820+ CALL(MapNames::getClNamespace() +
821+ "ext::oneapi::experimental::set_access_mode",
822+ ARG(0), ARG(1), MEMBER_EXPR(DEREF(2), false, LITERAL("flags")),
823+ MEMBER_CALL(CALL(MapNames::getDpctNamespace() + "get_device",
824+ MEMBER_EXPR(DEREF(2), false,
825+ LITERAL("location.id"))),
826+ false, "get_context"))))),
827+ UNSUPPORT_FACTORY_ENTRY("cuMemSetAccess",
828+ Diagnostics::TRY_EXPERIMENTAL_FEATURE,
829+ ARG("cuMemSetAccess"),
830+ ARG("--use-experimental-features=virtual_memory")))
831+
701832CONDITIONAL_FACTORY_ENTRY(
702833 UsePeerAccess(),
703834 ASSIGNABLE_FACTORY(ASSIGN_FACTORY_ENTRY(
0 commit comments