What is compound gerund and how would I separate them from perfect participles? Like
I heard of his having gained a promotion
He went away having forgotten it
First, participles are formed from verbs and are most often used as a part of a verb. Example: The bulls were running.
But participles can also be used as adjectives. Example: The running bulls filled the streets.
And they can be used as nouns. When used as nouns, participles are called "gerunds." Example: The running of the bulls in Pamplona occurs in July.
There is no difference in form, pronunciation, or orthography between participles used as part of a verb. as an adjective, or as a gerund. The difference is in grammatical function and is of importance only in describing how language is used.
The verb "hear of" requires a noun as an object. Therefore, the participial form "having gained" in your first example is being used a noun and therefore is a gerund. That its use is as a noun is shown by the possesive "his." It was what was heard.
The verb "go away" does not take an object. The participial form "having forgotten" is an adjective relating to the subject of the sentence, namely "He."
It is a difference in grammatical function, not form, that distinguishes "gerunds" from "participles." Because there is no difference in form, it would be less confusing to students to say that a participle can be used as a part of a verb, an adjective, or a noun and to forget the word "gerund" altogether.